Skip to content
4 changes: 2 additions & 2 deletions packages/functions_client/lib/src/functions_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ class FunctionsClient {
);
final fields = body as Map<String, String>?;

request = http.MultipartRequest(method.name, uri)
request = http.MultipartRequest(method.value, uri)
..fields.addAll(fields ?? {})
..files.addAll(files);
} else {
final bodyRequest = http.Request(method.name, uri);
final bodyRequest = http.Request(method.value, uri);

if (body == null) {
// No body to set
Expand Down
14 changes: 9 additions & 5 deletions packages/functions_client/lib/src/types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ import 'dart:typed_data';
import 'package:http/http.dart';

enum HttpMethod {
get,
post,
put,
delete,
patch,
get("GET"),
post("POST"),
put("PUT"),
delete("DELETE"),
patch("PATCH");

/// The uppercase HTTP method name. This should be used for a [Request]
final String value;
const HttpMethod(this.value);
}

class FunctionResponse {
Expand Down
8 changes: 4 additions & 4 deletions packages/functions_client/test/functions_dart_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void main() {
);

final req = customHttpClient.receivedRequests.last;
expect(req.method, 'get');
expect(req.method, 'GET');
});

test('PUT method', () async {
Expand All @@ -196,7 +196,7 @@ void main() {
);

final req = customHttpClient.receivedRequests.last;
expect(req.method, 'put');
expect(req.method, 'PUT');
});

test('DELETE method', () async {
Expand All @@ -206,7 +206,7 @@ void main() {
);

final req = customHttpClient.receivedRequests.last;
expect(req.method, 'delete');
expect(req.method, 'DELETE');
});

test('PATCH method', () async {
Expand All @@ -216,7 +216,7 @@ void main() {
);

final req = customHttpClient.receivedRequests.last;
expect(req.method, 'patch');
expect(req.method, 'PATCH');
});
});

Expand Down
26 changes: 0 additions & 26 deletions packages/supabase/lib/src/realtime_client_options.dart

This file was deleted.

1 change: 1 addition & 0 deletions packages/supabase/lib/src/supabase_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ class SupabaseClient {
'apikey': _supabaseKey,
},
headers: {'apikey': _supabaseKey, ...headers},
transport: options.webSocketTransport,
logLevel: options.logLevel,
httpClient: _authHttpClient,
timeout: options.timeout ?? RealtimeConstants.defaultTimeout,
Expand Down
44 changes: 44 additions & 0 deletions packages/supabase/lib/src/supabase_client_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,47 @@ class StorageClientOptions {

const StorageClientOptions({this.retryAttempts = 0});
}

/// {@template realtime_client_options}
/// Options to pass to the RealtimeClient.
/// {@endtemplate}
class RealtimeClientOptions {
/// How many events the RealtimeClient can push in a second
///
/// Defaults to 10 events per second
@Deprecated(
'Client side rate limit has been removed. This option will be ignored.')
final int? eventsPerSecond;

/// Level of realtime server logs to be logged
final RealtimeLogLevel? logLevel;

/// the timeout to trigger push timeouts
final Duration? timeout;

/// The WebSocket implementation to use
final WebSocketTransport? webSocketTransport;

/// {@macro realtime_client_options}
const RealtimeClientOptions({
this.eventsPerSecond,
this.logLevel,
this.timeout,
this.webSocketTransport,
});

RealtimeClientOptions copyWith({
int? eventsPerSecond,
RealtimeLogLevel? logLevel,
Duration? timeout,
WebSocketTransport? webSocketTransport,
}) {
return RealtimeClientOptions(
// ignore: deprecated_member_use_from_same_package
eventsPerSecond: eventsPerSecond ?? this.eventsPerSecond,
logLevel: logLevel ?? this.logLevel,
timeout: timeout ?? this.timeout,
webSocketTransport: webSocketTransport ?? this.webSocketTransport,
);
}
}
1 change: 0 additions & 1 deletion packages/supabase/lib/supabase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export 'package:realtime_client/realtime_client.dart';
export 'package:storage_client/storage_client.dart';

export 'src/auth_user.dart';
export 'src/realtime_client_options.dart';
export 'src/remove_subscription_result.dart';
export 'src/supabase_client.dart';
export 'src/supabase_client_options.dart';
Expand Down
Loading