Skip to content

README examples contain syntax errors and inconsistent API class names #111

@LocNguyenSGU

Description

@LocNguyenSGU

Summary

The README currently contains a few copy-paste issues in the example code that can break onboarding for users trying the SDK for the first time.

Current Behavior

Several README examples appear to have syntax or consistency problems:

  1. The createProfile example is missing a comma in the attributes object.
  2. The image upload example imports ImageApi but instantiates ImagesApi.
  3. The image upload example appears to be missing the closing ) / ); for the catch(...) block.
  4. One fenced code block appears to be closed with 4 backticks instead of 3.

Expected Behavior

The README examples should be valid, copy-pasteable, and use consistent class names so users can run them without needing to debug the docs first.

Evidence

1) createProfile example missing comma

In the README section for createProfile, the example currently shows:

let profile: ProfileCreateQuery = {
  data: {
  type: ProfileEnum.Profile,
  attributes: {
    email: "[email protected]"
    }
  }
}

The email field is missing a trailing comma, which makes the snippet invalid as shown.

2) Image upload example uses inconsistent class names

The README currently shows:

import {ApiKeySession, ImageApi } from 'klaviyo-api'

const session = new ApiKeySession("< YOUR API KEY HERE >")
const imageApi = new ImagesApi(session)

This imports ImageApi but instantiates ImagesApi.

3) Image upload example appears incomplete

The same block currently ends with:

imageApi.uploadImageFromFile(fs.createReadStream("./test_image.jpeg")).then(result => {
    console.log(result.body)
}).catch(error => {
  console.log(error)
}

This appears to be missing the closing ) / );.

4) Fenced code block formatting issue

In the “Organizational Helpers” section, one code block appears to close with 4 backticks instead of 3, which may affect markdown rendering.

Reproduction

  1. Open the repository README.
  2. Copy the example snippets into a TypeScript file.
  3. Try to run or type-check them.
  4. Observe syntax / naming inconsistencies in the examples above.

Duplicate Check

  • Open issues checked: no direct match found
  • Closed issues checked: no direct match found
  • Recent PRs checked: no direct match found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions