Skip to content

chore: 🐝 Update SDK - Generate 0.2.0 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.DS_Store
**/.speakeasy/temp/
**/.speakeasy/logs/
.DS_Store
/models
/models/errors
/types
Expand Down
76 changes: 38 additions & 38 deletions .speakeasy/gen.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,27 @@ generation:
maintainOpenAPIOrder: true
usageSnippets:
optionalPropertyRendering: withExample
sdkInitStyle: constructor
useClassNamesForArrayFields: true
fixes:
nameResolutionDec2023: true
nameResolutionFeb2025: false
parameterOrderingFeb2024: true
requestResponseComponentNamesFeb2024: true
securityFeb2025: true
sharedErrorComponentsApr2025: false
auth:
oAuth2ClientCredentialsEnabled: true
oAuth2PasswordEnabled: true
typescript:
version: 0.1.0
version: 0.2.0
additionalDependencies:
dependencies: {}
devDependencies: {}
peerDependencies: {}
additionalPackageJSON: {}
author: speakeasyapi
baseErrorName: HubspotError
clientServerStatusCodesAsErrors: true
defaultErrorName: APIError
enableCustomCodeRegions: false
Expand Down
10 changes: 5 additions & 5 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
speakeasyVersion: 1.521.1
speakeasyVersion: 1.557.0
sources:
CRM:
sourceNamespace: crm
Expand All @@ -9,20 +9,20 @@ sources:
- v3
HubspotCRM:
sourceNamespace: hubspot-crm
sourceRevisionDigest: sha256:068f049648f508cd2c1f0b3f74fdec83a2920b10763541b84a05644ba5fac7f9
sourceRevisionDigest: sha256:4b920509e176a73262dfd4a386791f13a0bdbd538caf6dee3f680981dbfb657b
sourceBlobDigest: sha256:fd3bb26f0d19170b271fae7398ffb1b2dbe48799b6e7c4dee95ec5c58302f332
tags:
- latest
- speakeasy-sdk-regen-1742493224
- speakeasy-sdk-regen-1743711404
- v3
targets:
hubspot:
source: HubspotCRM
sourceNamespace: hubspot-crm
sourceRevisionDigest: sha256:068f049648f508cd2c1f0b3f74fdec83a2920b10763541b84a05644ba5fac7f9
sourceRevisionDigest: sha256:4b920509e176a73262dfd4a386791f13a0bdbd538caf6dee3f680981dbfb657b
sourceBlobDigest: sha256:fd3bb26f0d19170b271fae7398ffb1b2dbe48799b6e7c4dee95ec5c58302f332
codeSamplesNamespace: hubspot-crm-typescript-code-samples
codeSamplesRevisionDigest: sha256:d61859db7b587ca10a3a1abaff25b520db3c9e1e3f8cfde32e27cd069c6e5a2a
codeSamplesRevisionDigest: sha256:9d63f8a7ebe06cb08da4c6542e29daea2a82959c4df9bb24a952e55d7fc476c3
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
29 changes: 6 additions & 23 deletions FUNCTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ specific category of applications.
```typescript
import { HubspotCore } from "mcp-hubspot/core.js";
import { basicGetProperties } from "mcp-hubspot/funcs/basicGetProperties.js";
import { SDKValidationError } from "mcp-hubspot/models/errors/sdkvalidationerror.js";

// Use `HubspotCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
Expand All @@ -31,30 +30,14 @@ const hubspot = new HubspotCore({

async function run() {
const res = await basicGetProperties(hubspot, {
objectType: "deals",
objectType: "contacts",
});

switch (true) {
case res.ok:
// The success case will be handled outside of the switch block
break;
case res.error instanceof SDKValidationError:
// Pretty-print validation errors.
return console.log(res.error.pretty());
case res.error instanceof Error:
return console.log(res.error);
default:
// TypeScript's type checking will fail on the following line if the above
// cases were not exhaustive.
res.error satisfies never;
throw new Error("Assertion failed: expected error checks to be exhaustive: " + res.error);
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("basicGetProperties failed:", res.error);
}


const { value: result } = res;

// Handle the result
console.log(result);
}

run();
Expand Down
91 changes: 41 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,9 @@ const hubspot = new Hubspot({

async function run() {
const result = await hubspot.basic.getProperties({
objectType: "deals",
objectType: "contacts",
});

// Handle the result
console.log(result);
}

Expand Down Expand Up @@ -214,10 +213,9 @@ const hubspot = new Hubspot({

async function run() {
const result = await hubspot.basic.getProperties({
objectType: "deals",
objectType: "contacts",
});

// Handle the result
console.log(result);
}

Expand Down Expand Up @@ -300,7 +298,7 @@ const hubspot = new Hubspot({

async function run() {
const result = await hubspot.basic.getProperties({
objectType: "deals",
objectType: "contacts",
}, {
retries: {
strategy: "backoff",
Expand All @@ -314,7 +312,6 @@ async function run() {
},
});

// Handle the result
console.log(result);
}

Expand Down Expand Up @@ -342,10 +339,9 @@ const hubspot = new Hubspot({

async function run() {
const result = await hubspot.basic.getProperties({
objectType: "deals",
objectType: "contacts",
});

// Handle the result
console.log(result);
}

Expand All @@ -357,51 +353,38 @@ run();
<!-- Start Error Handling [errors] -->
## Error Handling

If the request fails due to, for example 4XX or 5XX status codes, it will throw a `APIError`.
[`HubspotError`](./src/models/errors/hubspoterror.ts) is the base class for all HTTP error responses. It has the following properties:

| Error Type | Status Code | Content Type |
| --------------- | ----------- | ------------ |
| errors.APIError | 4XX, 5XX | \*/\* |
| Property | Type | Description |
| ------------------- | ---------- | ------------------------------------------------------ |
| `error.message` | `string` | Error message |
| `error.statusCode` | `number` | HTTP response status code eg `404` |
| `error.headers` | `Headers` | HTTP response headers |
| `error.body` | `string` | HTTP body. Can be empty string if no body is returned. |
| `error.rawResponse` | `Response` | Raw HTTP response |

### Example
```typescript
import { Hubspot } from "mcp-hubspot";
import { SDKValidationError } from "mcp-hubspot/models/errors";
import * as errors from "mcp-hubspot/models/errors";

const hubspot = new Hubspot({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});

async function run() {
let result;
try {
result = await hubspot.basic.getProperties({
objectType: "deals",
const result = await hubspot.basic.getProperties({
objectType: "contacts",
});

// Handle the result
console.log(result);
} catch (err) {
switch (true) {
// The server response does not match the expected SDK schema
case (err instanceof SDKValidationError):
{
// Pretty-print will provide a human-readable multi-line error message
console.error(err.pretty());
// Raw value may also be inspected
console.error(err.rawValue);
return;
}
apierror.js;
// Server returned an error status code or an unknown content type
case (err instanceof APIError): {
console.error(err.statusCode);
console.error(err.rawResponse.body);
return;
}
default: {
// Other errors such as network errors, see HTTPClientErrors for more details
throw err;
}
} catch (error) {
if (error instanceof errors.HubspotError) {
console.log(error.message);
console.log(error.statusCode);
console.log(error.body);
console.log(error.headers);
}
}
}
Expand All @@ -410,17 +393,26 @@ run();

```

Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted multi-line string since validation errors can list many issues and the plain error string may be difficult read when debugging.
### Error Classes
**Primary error:**
* [`HubspotError`](./src/models/errors/hubspoterror.ts): The base class for HTTP error responses.

<details><summary>Less common errors (6)</summary>

<br />

In some rare cases, the SDK can fail to get a response from the server or even make the request due to unexpected circumstances such as network conditions. These types of errors are captured in the `models/errors/httpclienterrors.ts` module:
**Network errors:**
* [`ConnectionError`](./src/models/errors/httpclienterrors.ts): HTTP client was unable to make a request to a server.
* [`RequestTimeoutError`](./src/models/errors/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal.
* [`RequestAbortedError`](./src/models/errors/httpclienterrors.ts): HTTP request was aborted by the client.
* [`InvalidRequestError`](./src/models/errors/httpclienterrors.ts): Any input used to create a request is invalid.
* [`UnexpectedClientError`](./src/models/errors/httpclienterrors.ts): Unrecognised or unexpected error.

| HTTP Client Error | Description |
| ---------------------------------------------------- | ---------------------------------------------------- |
| RequestAbortedError | HTTP request was aborted by the client |
| RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
| ConnectionError | HTTP client was unable to make a request to a server |
| InvalidRequestError | Any input used to create a request is invalid |
| UnexpectedClientError | Unrecognised or unexpected error |

**Inherit from [`HubspotError`](./src/models/errors/hubspoterror.ts)**:
* [`ResponseValidationError`](./src/models/errors/responsevalidationerror.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.

</details>
<!-- End Error Handling [errors] -->

<!-- Start Server Selection [server] -->
Expand All @@ -439,10 +431,9 @@ const hubspot = new Hubspot({

async function run() {
const result = await hubspot.basic.getProperties({
objectType: "deals",
objectType: "contacts",
});

// Handle the result
console.log(result);
}

Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,14 @@ Based on:
### Generated
- [typescript v0.1.0] .
### Releases
- [NPM v0.1.0] https://www.npmjs.com/package/mcp-hubspot/v/0.1.0 - .
- [NPM v0.1.0] https://www.npmjs.com/package/mcp-hubspot/v/0.1.0 - .

## 2025-06-07 00:17:29
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.557.0 (2.623.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.2.0] .
### Releases
- [NPM v0.2.0] https://www.npmjs.com/package/mcp-hubspot/v/0.2.0 - .
3 changes: 1 addition & 2 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ const hubspot = new Hubspot({

async function run() {
const result = await hubspot.basic.getProperties({
objectType: "deals",
objectType: "contacts",
});

// Handle the result
console.log(result);
}

Expand Down
2 changes: 1 addition & 1 deletion docs/models/components/associationcategory.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
```typescript
import { AssociationCategory } from "mcp-hubspot/models/components";

let value: AssociationCategory = "USER_DEFINED";
let value: AssociationCategory = "HUBSPOT_DEFINED";
```

## Values
Expand Down
2 changes: 1 addition & 1 deletion docs/models/components/associationspec.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AssociationSpec } from "mcp-hubspot/models/components";

let value: AssociationSpec = {
associationCategory: "USER_DEFINED",
associationTypeId: 652103,
associationTypeId: 754129,
};
```

Expand Down
7 changes: 1 addition & 6 deletions docs/models/components/collectionresponseassociatedid.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ let value: CollectionResponseAssociatedId = {
after: "NTI1Cg%3D%3D",
},
},
results: [
{
id: "<id>",
type: "<value>",
},
],
results: [],
};
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { CollectionResponseWithTotalSimplePublicObjectForwardPaging } from "mcp-hubspot/models/components";

let value: CollectionResponseWithTotalSimplePublicObjectForwardPaging = {
total: 431418,
total: 371377,
paging: {
next: {
link: "?after=NTI1Cg%3D%3D",
Expand Down
2 changes: 1 addition & 1 deletion docs/models/components/filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Filter } from "mcp-hubspot/models/components";

let value: Filter = {
propertyName: "<value>",
operator: "GTE",
operator: "IN",
};
```

Expand Down
2 changes: 1 addition & 1 deletion docs/models/components/filtergroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let value: FilterGroup = {
filters: [
{
propertyName: "<value>",
operator: "CONTAINS_TOKEN",
operator: "LT",
},
],
};
Expand Down
2 changes: 1 addition & 1 deletion docs/models/components/operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ null
```typescript
import { Operator } from "mcp-hubspot/models/components";

let value: Operator = "GT";
let value: Operator = "BETWEEN";
```

## Values
Expand Down
4 changes: 2 additions & 2 deletions docs/models/components/publicassociationsforobject.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { PublicAssociationsForObject } from "mcp-hubspot/models/components";
let value: PublicAssociationsForObject = {
types: [
{
associationCategory: "USER_DEFINED",
associationTypeId: 590873,
associationCategory: "HUBSPOT_DEFINED",
associationTypeId: 551132,
},
],
to: {
Expand Down
Loading