Skip to content

Commit 007c68a

Browse files
docs: docs for grpc client without autogen
1 parent c8744fe commit 007c68a

8 files changed

Lines changed: 253 additions & 82 deletions

File tree

docs/api_reference.rst

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ Main Classes
1212
- **ClassifierSdk**: Main entry point for interacting with the Athena service. Handles authentication, deployment management, and image classification.
1313
- **ClassifierServiceClient**: Low-level gRPC client for direct service calls.
1414
- **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.
1815

1916
Usage Example
2017
-------------
@@ -63,29 +60,5 @@ API Classes
6360
.. js:autoclass:: ClassifierServiceClient
6461
:members:
6562

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:
63+
.. js:autoclass:: ClassifyImageOptions
64+
:members:

docs/athena-grpc-client.rst

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/athena-types.rst

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
Athena Generated Types
2+
======================
3+
4+
This document describes the TypeScript types and interfaces generated from the
5+
Athena protobuf definitions.
6+
7+
See the :doc:`athena_protobufs:index` for more information about the protobuf
8+
definitions.
9+
10+
11+
Request Types
12+
-------------
13+
14+
ClassifyRequest
15+
~~~~~~~~~~~~~~~
16+
17+
Request message for image classification.
18+
19+
* ``deploymentId: string`` - Deployment identifier for routing responses
20+
* ``inputs: ClassificationInput[]`` - Array of images to classify
21+
22+
ClassificationInput
23+
~~~~~~~~~~~~~~~~~~~
24+
25+
Single image classification input.
26+
27+
* ``affiliate: string`` - Source system identifier
28+
* ``correlationId: string`` - Unique ID for matching responses
29+
* ``encoding: RequestEncoding`` - Data compression format
30+
* ``data: Uint8Array`` - Raw image bytes
31+
* ``format: ImageFormat`` - Image file format
32+
* ``hashes: ImageHash[]`` - Image data hashes
33+
34+
Response Types
35+
--------------
36+
37+
ClassifyResponse
38+
~~~~~~~~~~~~~~~~
39+
40+
Response containing classification results.
41+
42+
* ``globalError?: ClassificationError`` - Error affecting entire request
43+
* ``outputs: ClassificationOutput[]`` - Individual image results
44+
45+
ClassificationOutput
46+
~~~~~~~~~~~~~~~~~~~~
47+
48+
Result for a single image.
49+
50+
* ``correlationId: string`` - Matches input correlation ID
51+
* ``classifications: Classification[]`` - Detected classifications
52+
* ``error?: ClassificationError`` - Image-specific error
53+
54+
Classification
55+
~~~~~~~~~~~~~~
56+
57+
Single classification result.
58+
59+
* ``label: string`` - Classification label
60+
* ``weight: number`` - Confidence score (0.0 - 1.0)
61+
62+
ClassificationError
63+
~~~~~~~~~~~~~~~~~~~
64+
65+
Error information.
66+
67+
* ``code: ErrorCode`` - Error type
68+
* ``message: string`` - Error description
69+
* ``details: string`` - Additional error context
70+
71+
Deployment Types
72+
----------------
73+
74+
ListDeploymentsResponse
75+
~~~~~~~~~~~~~~~~~~~~~~~
76+
77+
Response listing active deployments.
78+
79+
* ``deployments: Deployment[]`` - Array of deployment info
80+
81+
Deployment
82+
~~~~~~~~~~
83+
84+
Single deployment information.
85+
86+
* ``deploymentId: string`` - Deployment identifier
87+
* ``backlog: number`` - Number of queued responses
88+
89+
Utility Types
90+
-------------
91+
92+
ImageHash
93+
~~~~~~~~~
94+
95+
Hash of image data.
96+
97+
* ``value: string`` - Hash value
98+
* ``type: HashType`` - Hash algorithm type
99+
100+
Enums
101+
-----
102+
103+
ErrorCode
104+
~~~~~~~~~
105+
106+
* ``UNSPECIFIED = 0`` - Unknown error
107+
* ``IMAGE_TOO_LARGE = 2`` - Image exceeds size limits
108+
* ``MODEL_ERROR = 3`` - Classifier internal error
109+
* ``AFFILIATE_NOT_PERMITTED = 4`` - Access denied for affiliate
110+
111+
RequestEncoding
112+
~~~~~~~~~~~~~~~
113+
114+
* ``UNSPECIFIED = 0`` - Default (uncompressed)
115+
* ``UNCOMPRESSED = 1`` - Raw image data
116+
* ``BROTLI = 2`` - Brotli compressed data
117+
118+
ImageFormat
119+
~~~~~~~~~~~
120+
121+
* ``UNSPECIFIED = 0`` - Unknown format
122+
* ``GIF = 1`` - GIF format
123+
* ``JPEG = 2`` - JPEG format (.jpeg, .jpg, .jpe)
124+
* ``BMP = 3`` - BMP format
125+
* ``DIB = 4`` - DIB format
126+
* ``PNG = 5`` - PNG format
127+
* ``WEBP = 6`` - WebP format
128+
* ``PBM = 7`` - PBM format
129+
* ``PGM = 8`` - PGM format
130+
* ``PPM = 9`` - PPM format
131+
* ``PXM = 10`` - PXM format
132+
* ``PNM = 11`` - PNM format
133+
* ``PFM = 12`` - PFM format
134+
* ``SR = 13`` - SR format
135+
* ``RAS = 14`` - RAS format
136+
* ``TIFF = 15`` - TIFF format (.tiff, .tif)
137+
* ``HDR = 16`` - HDR format
138+
* ``PIC = 17`` - PIC format
139+
* ``RAW_UINT8 = 18`` - Raw 8-bit RGB data
140+
141+
HashType
142+
~~~~~~~~
143+
144+
* ``UNKNOWN = 0`` - Unknown hash type
145+
* ``MD5 = 1`` - MD5 hash
146+
* ``SHA1 = 2`` - SHA1 hash

docs/authenticationManager.rst

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Authentication Manager
2-
=====================
2+
======================
33

44
Manages OAuth authentication and token refresh for the Athena gRPC client. Handles acquiring and refreshing access tokens using the OAuth client credentials flow.
55

@@ -9,22 +9,24 @@ Manages OAuth authentication and token refresh for the Athena gRPC client. Hand
99
- Integrates with Athena gRPC client
1010

1111
**Usage Example:**
12+
1213
.. code-block:: typescript
1314
1415
import { AuthenticationManager } from './authenticationManager';
1516
const auth = new AuthenticationManager({
16-
clientId: 'your-client-id',
17-
clientSecret: 'your-client-secret',
18-
issuerUrl: 'https://issuer.example.com',
19-
scope: 'manage:classify',
17+
clientId: 'your-client-id',
18+
clientSecret: 'your-client-secret',
19+
issuerUrl: 'https://issuer.example.com',
20+
scope: 'manage:classify',
2021
});
2122
2223
**Options:**
23-
- `clientId`: OAuth client ID
24-
- `clientSecret`: OAuth client secret
25-
- `issuerUrl`: URL of the OAuth issuer
26-
- `autoRefresh`: Whether to automatically refresh the access token
27-
- `scope`: OAuth scope to request
24+
25+
* `clientId`: OAuth client ID
26+
* `clientSecret`: OAuth client secret
27+
* `issuerUrl`: URL of the OAuth issuer
28+
* `autoRefresh`: Whether to automatically refresh the access token
29+
* `scope`: OAuth scope to request
2830

2931
.. js:autoclass:: AuthenticationManager
3032
:members:

docs/conf.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@
1717
sys.path.insert(0, str(Path("../athena").resolve()))
1818

1919
# Project information
20-
project = 'Athena Classifier NodeJS SDK'
20+
project = "Athena Classifier NodeJS SDK"
2121
copyright = f"{datetime.now(timezone.utc).year}, Crisp"
2222
author = "Crisp"
2323
release = "1.0.0"
2424

25-
js_language = 'typescript'
26-
js_source_path = '../src/'
27-
jsdoc_config_path = '../typedoc.json'
25+
js_language = "typescript"
26+
js_source_path = "../src/"
27+
jsdoc_config_path = "../typedoc.json"
2828

2929
# Extensions
3030
extensions = [
31-
'sphinx_js',
31+
"sphinx_js",
3232
"sphinx.ext.autodoc",
3333
"sphinx.ext.napoleon",
3434
"sphinx.ext.viewcode",
@@ -63,7 +63,6 @@
6363
# Exclude files with duplicate documented objects
6464
"../src/athena/google/protobuf/empty.ts",
6565
"../src/athena/athena.ts",
66-
6766
]
6867

6968
# The theme to use for HTML and HTML Help pages
@@ -122,6 +121,10 @@
122121
intersphinx_mapping = {
123122
"python": ("https://docs.python.org/3", None),
124123
"grpc": ("https://grpc.github.io/grpc/python/", None),
124+
"athena_protobufs": (
125+
"https://crispthinking.github.io/athena-protobufs/",
126+
None,
127+
),
125128
}
126129

127130
# Create required directories if they don't exist

docs/grpc-client.rst

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
Athena gRPC Client
2+
==================
3+
4+
This document describes the gRPC client implementation for the Athena classifier service.
5+
6+
Client Interface
7+
----------------
8+
9+
IClassifierServiceClient
10+
~~~~~~~~~~~~~~~~~~~~~~~~
11+
12+
Interface defining all available operations for the classifier service.
13+
14+
* ``classify()`` - Bidirectional streaming for image classification
15+
* ``listDeployments()`` - Unary call to list active deployments
16+
17+
Client Implementation
18+
---------------------
19+
20+
ClassifierServiceClient
21+
~~~~~~~~~~~~~~~~~~~~~~~
22+
23+
Concrete implementation extending ``grpc.Client``.
24+
25+
Constructor
26+
^^^^^^^^^^^
27+
28+
``ClassifierServiceClient(address, credentials, options?, binaryOptions?)``
29+
30+
* ``address: string`` - Server address (e.g., "localhost:50051")
31+
* ``credentials: grpc.ChannelCredentials`` - Authentication credentials
32+
* ``options: grpc.ClientOptions`` - Optional client configuration
33+
* ``binaryOptions: Partial<BinaryReadOptions & BinaryWriteOptions>`` - Optional protobuf options
34+
35+
Methods
36+
-------
37+
38+
classify()
39+
~~~~~~~~~~
40+
41+
Performs image classification using bidirectional streaming.
42+
43+
**Signatures:**
44+
45+
* ``classify(metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientDuplexStream<ClassifyRequest, ClassifyResponse>``
46+
* ``classify(options?: grpc.CallOptions): grpc.ClientDuplexStream<ClassifyRequest, ClassifyResponse>``
47+
48+
**Returns:** ``grpc.ClientDuplexStream<ClassifyRequest, ClassifyResponse>``
49+
50+
**Features:**
51+
52+
* Bidirectional streaming for real-time classification
53+
* Deployment-based context sharing
54+
* Multiple affiliates can join the same deployment
55+
* Supports batch processing of multiple images per request
56+
57+
listDeployments()
58+
~~~~~~~~~~~~~~~~~
59+
60+
Retrieves a list of all active deployment IDs.
61+
62+
**Signatures:**
63+
64+
* ``listDeployments(input: Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback): grpc.ClientUnaryCall``
65+
* ``listDeployments(input: Empty, metadata: grpc.Metadata, callback): grpc.ClientUnaryCall``
66+
* ``listDeployments(input: Empty, options: grpc.CallOptions, callback): grpc.ClientUnaryCall``
67+
* ``listDeployments(input: Empty, callback): grpc.ClientUnaryCall``
68+
69+
**Parameters:**
70+
71+
* ``input: Empty`` - Empty message (no input parameters required)
72+
* ``metadata: grpc.Metadata`` - Optional gRPC metadata
73+
* ``options: grpc.CallOptions`` - Optional call options
74+
* ``callback: (err: grpc.ServiceError | null, value?: ListDeploymentsResponse) => void`` - Response callback
75+
76+
**Returns:** ``grpc.ClientUnaryCall``

0 commit comments

Comments
 (0)