Skip to content

Commit

Permalink
Add fern export of library
Browse files Browse the repository at this point in the history
  • Loading branch information
chimon2000 committed Aug 11, 2023
1 parent cf682e1 commit b11a362
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
import api from '@api/edenai'

import type {
TextModerationCreateBodyParam,
TextModerationCreateResponse200,
} from '@api/edenai/types'
import { ResultAsync, err, ok } from 'neverthrow'

export default class Client {
constructor(token: string) {
api.auth(token)
}

public textModeration(
params: TextModerationCreateBodyParam,
): ResultAsync<TextModerationResult, Error> {
return ResultAsync.fromPromise(
api.text_moderation_create(params),
(originalError) => new Error('issue', { cause: originalError }),
).andThen((response) => {
if (response.status !== 200) err(response.data)
return ok(response.data)
})
}
}

export class TextModerationError extends Error {}

export type TextModerationResult = TextModerationCreateResponse200
export * from './generated/typescript'

0 comments on commit b11a362

Please sign in to comment.