|
| 1 | + |
| 2 | +API Reference |
| 3 | +============= |
| 4 | + |
| 5 | +Overview |
| 6 | +-------- |
| 7 | +Athena NodeJS SDK provides real-time image classification for CSAM detection using gRPC. It supports session-based deployments, multi-affiliate collaboration, and a wide range of image formats and error handling features. |
| 8 | + |
| 9 | +Main Classes |
| 10 | +------------ |
| 11 | + |
| 12 | +- **ClassifierSdk**: Main entry point for interacting with the Athena service. Handles authentication, deployment management, and image classification. |
| 13 | +- **ClassifierServiceClient**: Low-level gRPC client for direct service calls. |
| 14 | +- **ClassifyImageOptions**: Options for sending image classification requests. |
| 15 | +- **Deployment**: Represents a deployment session. |
| 16 | +- **ClassifyRequest** / **ClassifyResponse**: Request and response types for image classification. |
| 17 | +- **ClassificationInput** / **ClassificationOutput** / **ClassificationError** / **Classification**: Types for input, output, and error handling. |
| 18 | + |
| 19 | +Usage Example |
| 20 | +------------- |
| 21 | + |
| 22 | +.. code-block:: javascript |
| 23 | +
|
| 24 | + import { ClassifierSdk } from 'athena-nodejs-sdk'; |
| 25 | +
|
| 26 | + const sdk = new ClassifierSdk({ |
| 27 | + deploymentId: 'your-deployment-id', |
| 28 | + affiliate: 'your-affiliate', |
| 29 | + authentication: { |
| 30 | + issuerUrl: 'https://issuer.example.com', |
| 31 | + clientId: 'your-client-id', |
| 32 | + clientSecret: 'your-client-secret', |
| 33 | + scope: 'manage:classify' |
| 34 | + } |
| 35 | + }); |
| 36 | +
|
| 37 | + await sdk.open(); |
| 38 | + const deployments = await sdk.listDeployments(); |
| 39 | + // Send image for classification |
| 40 | + await sdk.sendClassifyRequest({ |
| 41 | + imageStream: fs.createReadStream('image.jpg'), |
| 42 | + format: 'JPEG', |
| 43 | + }); |
| 44 | +
|
| 45 | + sdk.on('data', (response) => { |
| 46 | + console.log('Classification result:', response); |
| 47 | + }); |
| 48 | +
|
| 49 | + sdk.on('error', (err) => { |
| 50 | + console.error('Error:', err); |
| 51 | + }); |
| 52 | +
|
| 53 | + sdk.on('close', () => { |
| 54 | + console.log('Connection closed'); |
| 55 | + }); |
| 56 | +
|
| 57 | +API Classes |
| 58 | +----------- |
| 59 | + |
| 60 | +.. js:autoclass:: ClassifierSdk |
| 61 | + :members: |
| 62 | + |
| 63 | +.. js:autoclass:: ClassifierServiceClient |
| 64 | + :members: |
| 65 | + |
| 66 | +.. js:autointerface:: ClassifyImageOptions |
| 67 | + :members: |
| 68 | + |
| 69 | +.. js:autointerface:: ListDeploymentsResponse |
| 70 | + :members: |
| 71 | + |
| 72 | +.. js:autointerface:: Deployment |
| 73 | + :members: |
| 74 | + |
| 75 | +.. js:autointerface:: ClassifyResponse |
| 76 | + :members: |
| 77 | + |
| 78 | +.. js:autointerface:: ClassifyRequest |
| 79 | + :members: |
| 80 | + |
| 81 | +.. js:autointerface:: ClassificationOutput |
| 82 | + :members: |
| 83 | + |
| 84 | +.. js:autointerface:: ClassificationInput |
| 85 | + :members: |
| 86 | + |
| 87 | +.. js:autointerface:: ClassificationError |
| 88 | + :members: |
| 89 | + |
| 90 | +.. js:autointerface:: Classification |
| 91 | + :members: |
0 commit comments