Skip to content

Commit 9f7f1c7

Browse files
committed
moved caller type
1 parent 15ddca0 commit 9f7f1c7

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

src/api/http-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import { CLIENT_USER_AGENT, DEFAULT_TIMEOUT } from '@/src/api/constants';
1616
import {
17-
Caller,
1817
GuaranteedAPIResponse,
1918
HTTPClientOptions,
2019
HTTPRequestInfo,
@@ -23,6 +22,7 @@ import {
2322
import { HTTP1AuthHeaderFactories, HTTP1Strategy } from '@/src/api/http1';
2423
import { HTTP2Strategy } from '@/src/api/http2';
2524
import { Mutable } from '@/src/data-api/types/utils';
25+
import { Caller } from '@/src/client';
2626

2727
export class HttpClient {
2828
public readonly baseUrl: string;

src/api/types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
// limitations under the License.
1414

1515
import type { HTTP_METHODS } from '@/src/api/index';
16-
17-
export type Caller = [name: string, version?: string];
16+
import { Caller } from '@/src/client';
1817

1918
/**
2019
* @internal

src/client/types.ts

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,34 @@
1-
import { Caller } from '@/src/api';
1+
// Copyright DataStax, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
/**
16+
* The caller information to send with requests, of the form `[name, version?]`, or an array of such.
17+
*
18+
* **Intended generally for integrations or frameworks that wrap the client.**
19+
*
20+
* Used to identify the client making requests to the server.
21+
*
22+
* It will be sent in the headers of the request as such:
23+
* ```
24+
* User-Agent: ...<name>/<version> astra-db-ts/<version>
25+
* ```
26+
*
27+
* If no caller information is provided, the client will simply be identified as `astra-db-ts/<version>`.
28+
*
29+
* **NB. If providing an array of callers, they should be ordered from most important to least important.**
30+
*/
31+
export type Caller = [name: string, version?: string];
232

333
/**
434
* The default options for the {@link DataApiClient}. The Data API & DevOps specific options may be overridden
@@ -16,6 +46,8 @@ export interface RootClientOptions {
1646
/**
1747
* The caller information to send with requests, of the form `[name, version?]`, or an array of such.
1848
*
49+
* **Intended generally for integrations or frameworks that wrap the client.**
50+
*
1951
* The caller information is used to identify the client making requests to the server.
2052
*
2153
* It will be sent in the headers of the request as such:
@@ -26,7 +58,6 @@ export interface RootClientOptions {
2658
* If no caller information is provided, the client will simply be identified as `astra-db-ts/<version>`.
2759
*
2860
* **NB. If providing an array of callers, they should be ordered from most important to least important.**
29-
*
3061
* @example
3162
* ```typescript
3263
* // 'my-app/1.0.0 astra-db-ts/1.0.0'

0 commit comments

Comments
 (0)