Skip to content

Commit

Permalink
Rename Opts->Options, expect a non promise Config in session open
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles-Schleich committed Oct 24, 2024
1 parent 0306aaa commit 75b26be
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions zenoh-ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { ZBytes, IntoZBytes, deserialize_bool, deserialize_uint, deserialize_int
import { CongestionControl, ConsolidationMode, Priority, Reliability, Sample, SampleKind } from "./sample";
import { Publisher, Subscriber, FifoChannel, RingChannel } from "./pubsub";
import { IntoSelector, Parameters, IntoParameters, Query, Queryable, Reply, ReplyError, Selector } from "./query";
import { Session, RecvErr, Receiver, DeleteOpts, PutOpts, GetOptions, QueryableOpts, PublisherOptions } from "./session";
import { Session, RecvErr, Receiver, DeleteOptions, PutOptions, GetOptions, QueryableOptions, PublisherOptions } from "./session";
import { Config } from "./config";
import { Encoding, IntoEncoding } from "./encoding";

Expand All @@ -28,6 +28,6 @@ export { ZBytes, IntoZBytes, deserialize_bool, deserialize_uint, deserialize_int
export { CongestionControl, ConsolidationMode, Priority, Reliability, Sample, SampleKind };
export { Publisher, Subscriber, FifoChannel, RingChannel };
export { IntoSelector, Parameters, IntoParameters, Query, Queryable, Reply, ReplyError, Selector };
export { Session, RecvErr, Receiver, DeleteOpts, PutOpts, GetOptions, QueryableOpts, PublisherOptions };
export { Session, RecvErr, Receiver, DeleteOptions as DeleteOpts, PutOptions, GetOptions, QueryableOptions, PublisherOptions };
export { Config };
export { Encoding, IntoEncoding };
23 changes: 11 additions & 12 deletions zenoh-ts/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function executeAsync(func: any) {
* @prop {IntoZBytes=} attachment - Additional Data sent with the request
*/

export interface PutOpts {
export interface PutOptions {
encoding?: Encoding,
congestion_control?: CongestionControl,
priority?: Priority,
Expand All @@ -81,7 +81,7 @@ export interface PutOpts {
* @prop {boolean=} express - Express
* @prop {IntoZBytes=} attachment - Additional Data sent with the request
*/
export interface DeleteOpts {
export interface DeleteOptions {
congestion_control?: CongestionControl,
priority?: Priority,
express?: boolean,
Expand Down Expand Up @@ -113,7 +113,7 @@ export interface GetOptions {
* @prop complete - Change queryable completeness.
* @prop callback - Callback function for this queryable
*/
export interface QueryableOpts {
export interface QueryableOptions {
complete?: boolean,
callback?: (query: Query) => void,
}
Expand Down Expand Up @@ -172,9 +172,8 @@ export class Session {
*
*/

static async open(config: Promise<Config> | Config): Promise<Session> {
const cfg = await config;
let remote_session = await RemoteSession.new(cfg.locator);
static async open(config: Config): Promise<Session> {
let remote_session = await RemoteSession.new(config.locator);
return new Session(remote_session);
}

Expand All @@ -193,13 +192,13 @@ export class Session {
*
* @param {IntoKeyExpr} into_key_expr - something that implements intoKeyExpr
* @param {IntoZBytes} into_zbytes - something that implements intoValue
* @param {PutOpts=} put_opts - an interface for the options settings on puts
* @param {PutOptions=} put_opts - an interface for the options settings on puts
* @returns void
*/
put(
into_key_expr: IntoKeyExpr,
into_zbytes: IntoZBytes,
put_opts?: PutOpts,
put_opts?: PutOptions,
): void {
let key_expr = new KeyExpr(into_key_expr);
let z_bytes = new ZBytes(into_zbytes);
Expand Down Expand Up @@ -236,13 +235,13 @@ export class Session {
* Executes a Delete on a session, for a specific key expression KeyExpr
*
* @param {IntoKeyExpr} into_key_expr - something that implements intoKeyExpr
* @param {DeleteOpts} delete_opts - optional additional parameters to go with a delete function
* @param {DeleteOptions} delete_opts - optional additional parameters to go with a delete function
*
* @returns void
*/
delete(
into_key_expr: IntoKeyExpr,
delete_opts?: DeleteOpts
delete_opts?: DeleteOptions
): void {
let key_expr = new KeyExpr(into_key_expr);
let _congestion_control = congestion_control_to_int(delete_opts?.congestion_control);
Expand Down Expand Up @@ -433,13 +432,13 @@ export class Session {
* If a Queryable is created with a callback, it cannot be simultaneously polled for new Query's
*
* @param {IntoKeyExpr} key_expr - string of key_expression
* @param {QueryableOpts=} queryable_opts - Optional additional settings for a Queryable [QueryableOpts]
* @param {QueryableOptions=} queryable_opts - Optional additional settings for a Queryable [QueryableOptions]
*
* @returns Queryable
*/
async declare_queryable(
key_expr: IntoKeyExpr,
queryable_opts?: QueryableOpts
queryable_opts?: QueryableOptions
): Promise<Queryable> {
let _key_expr = new KeyExpr(key_expr);
let remote_queryable: RemoteQueryable;
Expand Down

0 comments on commit 75b26be

Please sign in to comment.