Class: Client

Client(options)

The APN client. Instances encapsulates the APN client and all of its functions in order to allow multiple instances each with a different authentication credential to be in existence in parallel.

Constructor

new Client(options)

Initializes and configures the client for the APN Connector. This does not authenticate, use the async #connect method to do so as you see fit.

Parameters:
Name Type Description
options object

the options to pass to playwright. This also can be provided the browserType attribute which will allow you to specify the browser instance to use ('webkit', 'chromium', 'firefox'))

Source:

Classes

Client

Methods

(async) certificationsAll() → {Promise}

Gathers an export of all certifications within the APN. This is the same as the "Export All" button on the Certifications page. This will pull ALL registered certifications, not just Alliance team members, and as such may take a period of time to complete and return a large result set.

Source:
Returns:

a promise that resolves to an array of objects representing the certifications registered in the APN. Each object contains the following properties:

Type
Promise

(async) connect(username, password)

Open a new browser instance, if one isn't already available, and authenticate with the APN. This must be run before any and all other subsequent functions. This does not re-authenticate if an authentication session expires, that is left to the user of the library to handle as they see appropriate.

Parameters:
Name Type Description
username string

the APN username to authenticate with

password string

the APN password to authenticate with

Source:
Returns:

This instance of the client, allowing for chaining of functions

(async) end() → {Promise}

Close the browser instance and thereby the client. This will terminate all session information and require re-authentication to use the client again.

Source:
Returns:

a promise that resolves when the browser has fully closed, terminating all session information.

Type
Promise

(async) opportunitiesAll() → {Promise}

The initialization and authentication process to establish an authenticated session with the APN. This must be run before any and all other subsequent functions. This does not re-authenticate if an authentication session expires, that is left to the user of the library to handle as they see appropriate.

Source:
Throws:

if the excel file (and file conversion to JSON) cannot be completed as expected error is thrown. Reasons include: Not authenticated, issue with the APN site, etc.

Type
Error
Returns:

a promise that resolves when the authenticated session is fully queried and returned with the list of opportunities as a JSON Object.

Type
Promise

(async) opportunitiesUpdate(id, targetState)

Parameters:
Name Type Description
id string

ID of the opportunity to update, this should be the AWS opportunity ID value

targetState string

the target state to transition the opportunity to. This should be one of the following values:

Source:
Returns:

true if the opportunity was updated successfully

(async) scorecard() → {Promise}

Extracts the current Partner Scorecard from the AWS Partner Network (APN) and returns it as a JSON object.

Source:
Returns:

a promise that resolves to an object containing the following properties:

  • partnerId: the partner ID of the APN account
  • tierReviewDate: the date the tier review is due
  • companyName: the name of the company
  • feeRenewalDate: the date the APN fee is due
  • partnerPath: the current partner path
  • pathStage: the current path stage
  • currentAPNProgramFee: the current APN program fee
  • yearlyAPNProgramFee: the yearly APN program fee
  • knowledge: an object containing the following properties:
  • accreditedIndividuals: an object containing the following properties:
  • currentTier: an object containing the following properties:
    • achieved: the number of accredited individuals achieved
    • target: the number of accredited individuals required to achieve the next tier
  • upgradeTier: an object containing the following properties:
    • achieved: the number of accredited individuals achieved
    • target: the number of accredited individuals required to achieve the next tier
  • technicalAccreditedIndividuals: an object containing the following properties:
    • currentTier: an object containing the following properties:
      • achieved: the number of accredited individuals achieved
      • target: the number of accredited individuals required to achieve the next tier
    • upgradeTier: an object containing the following properties:
      • achieved: the number of accredited individuals achieved
      • target: the number of accredited individuals required to achieve the next tier
  • businessAccreditedIndividuals: an object containing the following properties:
    • currentTier: an object containing the following properties:
      • achieved: the number of accredited individuals achieved
      • target: the number of accredited individuals required to achieve the next tier
    • upgradeTier: an object containing the following properties:
      • achieved: the number of accredited individuals achieved
      • target: the number of accredited individuals required to achieve the next tier
  • foundationalCertifiedIndividuals: an object containing the following properties:
    • currentTier: an object containing the following properties:
      • achieved: the number of accredited individuals achieved
      • target: the number of accredited individuals required to achieve the next tier
    • upgradeTier: an object containing the following properties:
      • achieved: the number of accredited individuals achieved
      • target: the number of accredited individuals required to achieve the next tier
  • technicalCertifiedIndividuals: an object containing the following properties:
    • currentTier: an object containing the following properties:
      • achieved: the number of accredited individuals achieved
      • target: the number of accredited individuals required to achieve the next tier
    • upgradeTier: an object containing the following properties:
      • achieved: the number of accredited individuals achieved
      • target: the number of accredited individuals required to achieve the next tier
  • technicalCertifiedIndividualsProOrSpecialty: an object containing the following properties:
    • currentTier: an object containing the following properties:
      • achieved: the number of accredited individuals achieved
      • target: the number of accredited individuals required to achieve the next tier
    • upgradeTier: an object containing the following properties:
      • achieved: the number of accredited individuals achieved
      • target: the number of accredited individuals required to achieve the next tier
  • experience: an object containing the following properties:
  • launchedOpportunities: an object containing the following properties:
    • currentTier: an object containing the following properties:
      • achieved: the number of launched opportunities achieved
      • target: the number of launched opportunities required to achieve the next tier
    • upgradeTier: an object containing the following properties:
      • achieved: the number of launched opportunities achieved
      • target: the number of launched opportunities required to achieve the next tier
  • monthlyRecurringRevenue: an object containing the following properties:
    • currentTier: an object containing the following properties:
    • achieved: the amount of monthly recurring revenue achieved
      • target: the amount of monthly recurring revenue required to achieve the next tier
  • upgradeTier: an object containing the following properties:
  • achieved: the amount of monthly recurring revenue achieved
  • target: the amount of monthly recurring revenue required to achieve the next tier
  • customerSuccess: an object containing the following properties:
  • publiclyReferenceableCustomers: an object containing the following properties:
    • currentTier: an object containing the following properties:
      • achieved: the number of publicly referenceable customers achieved
      • target: the number of publicly referenceable customers required to achieve the next tier
    • upgradeTier: an object containing the following properties:
      • achieved: the number of publicly referenceable customers achieved
      • target: the number of publicly referenceable customers required to achieve the next tier
  • customerSatisfactionResponses: an object containing the following properties:
    • currentTier: an object containing the following properties:
      • achieved: the number of customer satisfaction responses achieved
      • target: the number of customer satisfaction responses required to achieve the next tier
    • upgradeTier: an object containing the following properties:
      • achieved: the number of customer satisfaction responses achieved
      • target: the number of customer satisfaction responses required to achieve the next tier
Type
Promise

(async) usersAll() → {Promise}

Gathers an export of all active users within the APN. This is the same as the "Export All" button on the Users page. This will pull ALL registered users, not just Alliance team members, and as such may take a period of time to complete and return a large result set.

Source:
Returns:

a promise that resolves to an array of objects representing the users in the APN. Each object contains the following properties:

  • Full Name: the full name of the user
  • Contact Type: The type of contact the user is (Alliance, Sales, etc.)
  • Title: the title of the user
  • Email: the email address of the user
  • T&C Account Email Entered: whether or not the user has entered an email address for the T&C account (true/false)
  • Phone: the phone number of the user
Type
Promise

(async) usersDeactivateByName(name)

Deactivates a user from the APN by their name. This is the same as the "Deactivate" button on the Users page. This will deactivate the user regardless of their contact type (Alliance, Sales, etc.). Note: use of this function is irreversible and will require manual intervention to re-activate the user. Furthermore, this function CAN be used to deactivate yourself, so use with caution.

Parameters:
Name Type Description
name string

Should be the exact name of the user to deactivate. This is NOT case sensitive. It should be an identifier to yield a single individual. If more than one result is returned, an error will be thrown and no user(s) will be deactivated.

Source:
Throws:

if the name provided yields zero (not found) or multiple (ambiguous) results) matches from the name. Note that if an exception is thrown, no users will be deactivated, failing safely.

Type
Error
Returns:

true if the user was deactivated successfully

(async, static) ancestor(element, match) → {object}

Find the ancestor node from the provide provided element that matches the provided match function.

Parameters:
Name Type Description
element object

the starting element to begin searching its ancestors for a match

match function

the function to use to match the ancestor element, must return true or false

Source:
Returns:

the element in the ancsestor chain that matches the provided match function

Type
object

(async, static) downloadExcelFile(downloadPromise)

Helper function to download an excel file from the APN and return it as an XLSX Workbook object.

Parameters:
Name Type Description
downloadPromise promise

A promise that resolves to a download request stream.

Source:
Returns:

An XLSX Workbook object

(async, static) getXLSX(_page, url)

Helper function to download a CSV file from the APN through a in-browser javascript context using the browsers fetch method and return it as a string.

Parameters:
Name Type Description
_page Page

The playwright browser page to use to execute the fetch command

url string

url to query for the fetch command

Source:
Returns:

A string of the requested resource

(async, static) scorecardBlock(page, blockName) → {string}

Query the scorecard block information from the APN and return the text content of the block.

Parameters:
Name Type Description
page object

the starting locator element to begin searching for the scorecard block

blockName string

the target name/text to work from to find the scorecard block

Source:
Returns:

the text content of the scorecard block

Type
string

(async, static) scorecardRow(page, blockName, nth) → {object}

Parses the information for the scorecard row from the APN and returns the current tier and upgrade tier values.

Parameters:
Name Type Default Description
page object

the starting/root element to query from

blockName string

the text name of the scorecard row to query for

nth integer 0

the nth row to query for, defaults to 0

Source:
Returns:

object returning the current tier and upgrade tier values for the scorecard row

Type
object

(static) targetedValue(content) → {object}

Helper function to parse targeted valeus from the APN scorecard. This is used to parse the X of Y values from the scorecard.

Parameters:
Name Type Description
content string

the textual content to parse for the targeted value (X of Y)

Source:
Returns:

an object containing the achieved and target values OR the original value if not of format X of Y

Type
object