Skip to content

Commit

Permalink
change add error definition
Browse files Browse the repository at this point in the history
  • Loading branch information
tatarco committed Dec 19, 2024
1 parent 5129aa9 commit ee9f420
Show file tree
Hide file tree
Showing 8 changed files with 398 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/models/components/bulkcreatesubscriberresponsedto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# BulkCreateSubscriberResponseDto

## Example Usage

```typescript
import { BulkCreateSubscriberResponseDto } from "@novu/api/models/components";

let value: BulkCreateSubscriberResponseDto = {
updated: [
{
subscriberId: "<id>",
},
],
created: [
{
subscriberId: "<id>",
},
],
failed: [
{},
],
};
```

## Fields

| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
| `updated` | [components.UpdatedSubscriberDto](../../models/components/updatedsubscriberdto.md)[] | :heavy_check_mark: | An array of subscribers that were successfully updated. |
| `created` | [components.CreatedSubscriberDto](../../models/components/createdsubscriberdto.md)[] | :heavy_check_mark: | An array of subscribers that were successfully created. |
| `failed` | [components.FailedOperationDto](../../models/components/failedoperationdto.md)[] | :heavy_check_mark: | An array of failed operations with error messages and optional subscriber IDs. |
17 changes: 17 additions & 0 deletions docs/models/components/createdsubscriberdto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# CreatedSubscriberDto

## Example Usage

```typescript
import { CreatedSubscriberDto } from "@novu/api/models/components";

let value: CreatedSubscriberDto = {
subscriberId: "<id>",
};
```

## Fields

| Field | Type | Required | Description |
| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ |
| `subscriberId` | *string* | :heavy_check_mark: | The ID of the subscriber that was created. |
16 changes: 16 additions & 0 deletions docs/models/components/failedoperationdto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# FailedOperationDto

## Example Usage

```typescript
import { FailedOperationDto } from "@novu/api/models/components";

let value: FailedOperationDto = {};
```

## Fields

| Field | Type | Required | Description |
| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| `message` | *string* | :heavy_minus_sign: | The error message associated with the failed operation. |
| `subscriberId` | *string* | :heavy_minus_sign: | The subscriber ID associated with the failed operation. This field is optional. |
17 changes: 17 additions & 0 deletions docs/models/components/updatedsubscriberdto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# UpdatedSubscriberDto

## Example Usage

```typescript
import { UpdatedSubscriberDto } from "@novu/api/models/components";

let value: UpdatedSubscriberDto = {
subscriberId: "<id>",
};
```

## Fields

| Field | Type | Required | Description |
| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ |
| `subscriberId` | *string* | :heavy_check_mark: | The ID of the subscriber that was updated. |
103 changes: 103 additions & 0 deletions src/models/components/bulkcreatesubscriberresponsedto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/

import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
CreatedSubscriberDto,
CreatedSubscriberDto$inboundSchema,
CreatedSubscriberDto$Outbound,
CreatedSubscriberDto$outboundSchema,
} from "./createdsubscriberdto.js";
import {
FailedOperationDto,
FailedOperationDto$inboundSchema,
FailedOperationDto$Outbound,
FailedOperationDto$outboundSchema,
} from "./failedoperationdto.js";
import {
UpdatedSubscriberDto,
UpdatedSubscriberDto$inboundSchema,
UpdatedSubscriberDto$Outbound,
UpdatedSubscriberDto$outboundSchema,
} from "./updatedsubscriberdto.js";

export type BulkCreateSubscriberResponseDto = {
/**
* An array of subscribers that were successfully updated.
*/
updated: Array<UpdatedSubscriberDto>;
/**
* An array of subscribers that were successfully created.
*/
created: Array<CreatedSubscriberDto>;
/**
* An array of failed operations with error messages and optional subscriber IDs.
*/
failed: Array<FailedOperationDto>;
};

/** @internal */
export const BulkCreateSubscriberResponseDto$inboundSchema: z.ZodType<
BulkCreateSubscriberResponseDto,
z.ZodTypeDef,
unknown
> = z.object({
updated: z.array(UpdatedSubscriberDto$inboundSchema),
created: z.array(CreatedSubscriberDto$inboundSchema),
failed: z.array(FailedOperationDto$inboundSchema),
});

/** @internal */
export type BulkCreateSubscriberResponseDto$Outbound = {
updated: Array<UpdatedSubscriberDto$Outbound>;
created: Array<CreatedSubscriberDto$Outbound>;
failed: Array<FailedOperationDto$Outbound>;
};

/** @internal */
export const BulkCreateSubscriberResponseDto$outboundSchema: z.ZodType<
BulkCreateSubscriberResponseDto$Outbound,
z.ZodTypeDef,
BulkCreateSubscriberResponseDto
> = z.object({
updated: z.array(UpdatedSubscriberDto$outboundSchema),
created: z.array(CreatedSubscriberDto$outboundSchema),
failed: z.array(FailedOperationDto$outboundSchema),
});

/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace BulkCreateSubscriberResponseDto$ {
/** @deprecated use `BulkCreateSubscriberResponseDto$inboundSchema` instead. */
export const inboundSchema = BulkCreateSubscriberResponseDto$inboundSchema;
/** @deprecated use `BulkCreateSubscriberResponseDto$outboundSchema` instead. */
export const outboundSchema = BulkCreateSubscriberResponseDto$outboundSchema;
/** @deprecated use `BulkCreateSubscriberResponseDto$Outbound` instead. */
export type Outbound = BulkCreateSubscriberResponseDto$Outbound;
}

export function bulkCreateSubscriberResponseDtoToJSON(
bulkCreateSubscriberResponseDto: BulkCreateSubscriberResponseDto,
): string {
return JSON.stringify(
BulkCreateSubscriberResponseDto$outboundSchema.parse(
bulkCreateSubscriberResponseDto,
),
);
}

export function bulkCreateSubscriberResponseDtoFromJSON(
jsonString: string,
): SafeParseResult<BulkCreateSubscriberResponseDto, SDKValidationError> {
return safeParse(
jsonString,
(x) => BulkCreateSubscriberResponseDto$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BulkCreateSubscriberResponseDto' from JSON`,
);
}
69 changes: 69 additions & 0 deletions src/models/components/createdsubscriberdto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/

import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type CreatedSubscriberDto = {
/**
* The ID of the subscriber that was created.
*/
subscriberId: string;
};

/** @internal */
export const CreatedSubscriberDto$inboundSchema: z.ZodType<
CreatedSubscriberDto,
z.ZodTypeDef,
unknown
> = z.object({
subscriberId: z.string(),
});

/** @internal */
export type CreatedSubscriberDto$Outbound = {
subscriberId: string;
};

/** @internal */
export const CreatedSubscriberDto$outboundSchema: z.ZodType<
CreatedSubscriberDto$Outbound,
z.ZodTypeDef,
CreatedSubscriberDto
> = z.object({
subscriberId: z.string(),
});

/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace CreatedSubscriberDto$ {
/** @deprecated use `CreatedSubscriberDto$inboundSchema` instead. */
export const inboundSchema = CreatedSubscriberDto$inboundSchema;
/** @deprecated use `CreatedSubscriberDto$outboundSchema` instead. */
export const outboundSchema = CreatedSubscriberDto$outboundSchema;
/** @deprecated use `CreatedSubscriberDto$Outbound` instead. */
export type Outbound = CreatedSubscriberDto$Outbound;
}

export function createdSubscriberDtoToJSON(
createdSubscriberDto: CreatedSubscriberDto,
): string {
return JSON.stringify(
CreatedSubscriberDto$outboundSchema.parse(createdSubscriberDto),
);
}

export function createdSubscriberDtoFromJSON(
jsonString: string,
): SafeParseResult<CreatedSubscriberDto, SDKValidationError> {
return safeParse(
jsonString,
(x) => CreatedSubscriberDto$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'CreatedSubscriberDto' from JSON`,
);
}
76 changes: 76 additions & 0 deletions src/models/components/failedoperationdto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/

import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type FailedOperationDto = {
/**
* The error message associated with the failed operation.
*/
message?: string | undefined;
/**
* The subscriber ID associated with the failed operation. This field is optional.
*/
subscriberId?: string | undefined;
};

/** @internal */
export const FailedOperationDto$inboundSchema: z.ZodType<
FailedOperationDto,
z.ZodTypeDef,
unknown
> = z.object({
message: z.string().optional(),
subscriberId: z.string().optional(),
});

/** @internal */
export type FailedOperationDto$Outbound = {
message?: string | undefined;
subscriberId?: string | undefined;
};

/** @internal */
export const FailedOperationDto$outboundSchema: z.ZodType<
FailedOperationDto$Outbound,
z.ZodTypeDef,
FailedOperationDto
> = z.object({
message: z.string().optional(),
subscriberId: z.string().optional(),
});

/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace FailedOperationDto$ {
/** @deprecated use `FailedOperationDto$inboundSchema` instead. */
export const inboundSchema = FailedOperationDto$inboundSchema;
/** @deprecated use `FailedOperationDto$outboundSchema` instead. */
export const outboundSchema = FailedOperationDto$outboundSchema;
/** @deprecated use `FailedOperationDto$Outbound` instead. */
export type Outbound = FailedOperationDto$Outbound;
}

export function failedOperationDtoToJSON(
failedOperationDto: FailedOperationDto,
): string {
return JSON.stringify(
FailedOperationDto$outboundSchema.parse(failedOperationDto),
);
}

export function failedOperationDtoFromJSON(
jsonString: string,
): SafeParseResult<FailedOperationDto, SDKValidationError> {
return safeParse(
jsonString,
(x) => FailedOperationDto$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'FailedOperationDto' from JSON`,
);
}
Loading

0 comments on commit ee9f420

Please sign in to comment.