Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions csharp/Svix/Authentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,6 @@ public class AuthenticationExpireAllOptions : SvixOptionsBase
}
}

public class AuthenticationDashboardAccessOptions : SvixOptionsBase
{
public string? IdempotencyKey { get; set; }

public new Dictionary<string, string> HeaderParams()
{
return SerializeParams(
new Dictionary<string, object?> { { "idempotency-key", IdempotencyKey } }
);
}
}

public class AuthenticationLogoutOptions : SvixOptionsBase
{
public string? IdempotencyKey { get; set; }
Expand Down Expand Up @@ -187,12 +175,7 @@ public bool ExpireAll(
}
}

/// <summary>
/// DEPRECATED: Please use `app-portal-access` instead.
///
/// Use this function to get magic links (and authentication codes) for connecting your users to the Consumer Application Portal.
/// </summary>
[Obsolete]
[Obsolete("Please use `AppPortalAccessAsync` instead")]
public async Task<DashboardAccessOut> DashboardAccessAsync(
string appId,
AuthenticationDashboardAccessOptions? options = null,
Expand All @@ -219,12 +202,7 @@ public async Task<DashboardAccessOut> DashboardAccessAsync(
}
}

/// <summary>
/// DEPRECATED: Please use `app-portal-access` instead.
///
/// Use this function to get magic links (and authentication codes) for connecting your users to the Consumer Application Portal.
/// </summary>
[Obsolete]
[Obsolete("Please use `AppPortalAccess` instead")]
public DashboardAccessOut DashboardAccess(
string appId,
AuthenticationDashboardAccessOptions? options = null
Expand Down
17 changes: 17 additions & 0 deletions csharp/Svix/Deprecated.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#nullable enable

namespace Svix
{
[Obsolete]
public class AuthenticationDashboardAccessOptions : SvixOptionsBase
{
public string? IdempotencyKey { get; set; }

public new Dictionary<string, string> HeaderParams()
{
return SerializeParams(
new Dictionary<string, object?> { { "idempotency-key", IdempotencyKey } }
);
}
}
}
51 changes: 51 additions & 0 deletions csharp/templates/api_extra/authentication_expire_all.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[Obsolete("Please use `AppPortalAccessAsync` instead")]
public async Task<DashboardAccessOut> DashboardAccessAsync(
string appId,
AuthenticationDashboardAccessOptions? options = null,
CancellationToken cancellationToken = default
)
{
try
{
var response = await _client.SvixHttpClient.SendRequestAsync<DashboardAccessOut>(
method: HttpMethod.Post,
path: "/api/v1/auth/dashboard-access/{app_id}",
pathParams: new Dictionary<string, string> { { "app_id", appId } },
queryParams: options?.QueryParams(),
headerParams: options?.HeaderParams(),
cancellationToken: cancellationToken
);
return response.Data;
}
catch (ApiException e)
{
_client.Logger?.LogError(e, $"{nameof(DashboardAccessAsync)} failed");

throw;
}
}

[Obsolete("Please use `AppPortalAccess` instead")]
public DashboardAccessOut DashboardAccess(
string appId,
AuthenticationDashboardAccessOptions? options = null
)
{
try
{
var response = _client.SvixHttpClient.SendRequest<DashboardAccessOut>(
method: HttpMethod.Post,
path: "/api/v1/auth/dashboard-access/{app_id}",
pathParams: new Dictionary<string, string> { { "app_id", appId } },
queryParams: options?.QueryParams(),
headerParams: options?.HeaderParams()
);
return response.Data;
}
catch (ApiException e)
{
_client.Logger?.LogError(e, $"{nameof(DashboardAccess)} failed");

throw;
}
}
8 changes: 1 addition & 7 deletions go/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ type AuthenticationExpireAllOptions struct {
IdempotencyKey *string
}

type AuthenticationDashboardAccessOptions struct {
IdempotencyKey *string
}

type AuthenticationLogoutOptions struct {
IdempotencyKey *string
}
Expand Down Expand Up @@ -94,9 +90,7 @@ func (authentication *Authentication) ExpireAll(
return err
}

// DEPRECATED: Please use `app-portal-access` instead.
//
// Use this function to get magic links (and authentication codes) for connecting your users to the Consumer Application Portal.
// Deprecated: Please use `AppPortalAccess` instead.
func (authentication *Authentication) DashboardAccess(
ctx context.Context,
appId string,
Expand Down
5 changes: 5 additions & 0 deletions go/deprecated.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package svix

type AuthenticationDashboardAccessOptions struct {
IdempotencyKey *string
}
26 changes: 10 additions & 16 deletions java/lib/src/main/java/com/svix/api/Authentication.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.svix.models.AppPortalAccessIn;
import com.svix.models.AppPortalAccessOut;
import com.svix.models.ApplicationTokenExpireIn;
import com.svix.models.DashboardAccessOut;

import okhttp3.Headers;
import okhttp3.HttpUrl;
Expand Down Expand Up @@ -84,28 +83,19 @@ public void expireAll(
}

/**
* DEPRECATED: Please use `app-portal-access` instead.
*
* <p>Use this function to get magic links (and authentication codes) for connecting your users
* to the Consumer Application Portal.
*
* @deprecated
* @deprecated Please use appPortalAccess instead.
*/
@Deprecated
public DashboardAccessOut dashboardAccess(final String appId) throws IOException, ApiException {
public com.svix.models.DashboardAccessOut dashboardAccess(final String appId)
throws IOException, ApiException {
return this.dashboardAccess(appId, new AuthenticationDashboardAccessOptions());
}

/**
* DEPRECATED: Please use `app-portal-access` instead.
*
* <p>Use this function to get magic links (and authentication codes) for connecting your users
* to the Consumer Application Portal.
*
* @deprecated
* @deprecated Please use appPortalAccess instead.
*/
@Deprecated
public DashboardAccessOut dashboardAccess(
public com.svix.models.DashboardAccessOut dashboardAccess(
final String appId, final AuthenticationDashboardAccessOptions options)
throws IOException, ApiException {
HttpUrl.Builder url =
Expand All @@ -117,7 +107,11 @@ public DashboardAccessOut dashboardAccess(
headers.put("idempotency-key", options.idempotencyKey);
}
return this.client.executeRequest(
"POST", url.build(), Headers.of(headers), null, DashboardAccessOut.class);
"POST",
url.build(),
Headers.of(headers),
null,
com.svix.models.DashboardAccessOut.class);
}

/**
Expand Down
23 changes: 23 additions & 0 deletions java/templates/api_extra/authentication_expire_all.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/** @deprecated Please use appPortalAccess instead. */
@Deprecated
public com.svix.models.DashboardAccessOut dashboardAccess(final String appId)
throws IOException, ApiException {
return this.dashboardAccess(appId, new AuthenticationDashboardAccessOptions());
}

/** @deprecated Please use appPortalAccess instead. */
@Deprecated
public com.svix.models.DashboardAccessOut dashboardAccess(
final String appId, final AuthenticationDashboardAccessOptions options)
throws IOException, ApiException {
HttpUrl.Builder url =
this.client
.newUrlBuilder()
.encodedPath(String.format("/api/v1/auth/dashboard-access/%s", appId));
Map<String, String> headers = new HashMap<>();
if (options.idempotencyKey != null) {
headers.put("idempotency-key", options.idempotencyKey);
}
return this.client.executeRequest(
"POST", url.build(), Headers.of(headers), null, com.svix.models.DashboardAccessOut.class);
}
13 changes: 4 additions & 9 deletions javascript/src/api/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ export interface AuthenticationExpireAllOptions {
idempotencyKey?: string;
}

export interface AuthenticationDashboardAccessOptions {
export interface AuthenticationLogoutOptions {
idempotencyKey?: string;
}

export interface AuthenticationLogoutOptions {
/** @deprecated */
export interface AuthenticationDashboardAccessOptions {
idempotencyKey?: string;
}

Expand Down Expand Up @@ -74,13 +75,7 @@ export class Authentication {
return request.sendNoResponseBody(this.requestCtx);
}

/**
* DEPRECATED: Please use `app-portal-access` instead.
*
* Use this function to get magic links (and authentication codes) for connecting your users to the Consumer Application Portal.
*
* @deprecated
*/
/** @deprecated Please use `appPortalAccess` instead. */
public dashboardAccess(
appId: string,
options?: AuthenticationDashboardAccessOptions
Expand Down
5 changes: 5 additions & 0 deletions javascript/src/api_internal/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ export interface AuthenticationStreamPortalAccessOptions {
idempotencyKey?: string;
}

/** @deprecated */
export interface AuthenticationDashboardAccessOptions {
idempotencyKey?: string;
}

export class Authentication {
public constructor(private readonly requestCtx: SvixRequestContext) {}

Expand Down
15 changes: 15 additions & 0 deletions javascript/templates/api_extra/authentication_expire_all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** @deprecated Please use `appPortalAccess` instead. */
public dashboardAccess(
appId: string,
options?: AuthenticationDashboardAccessOptions
): Promise<DashboardAccessOut> {
const request = new SvixRequest(
HttpMethod.POST,
"/api/v1/auth/dashboard-access/{app_id}"
);

request.setPathParam("app_id", appId);
request.setHeaderParam("idempotency-key", options?.idempotencyKey);

return request.send(this.requestCtx, DashboardAccessOutSerializer._fromJsonObject);
}
15 changes: 15 additions & 0 deletions javascript/templates/api_resource.ts.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import {
{{ c | to_upper_camel_case }}Serializer,
} from '../models/{{ c | to_lower_camel_case }}';
{% endfor -%}
{# HACK: can't easily do this with api_extra files -#}
{% if resource.name == "authentication" -%}
import {
DashboardAccessOut,
DashboardAccessOutSerializer,
} from "../models/dashboardAccessOut";
{% endif -%}
{% for _, sub in resource.subresources | items -%}
import { {{ sub.name | to_upper_camel_case}} } from './{{ sub.name | to_lower_camel_case }}';
{% endfor -%}
Expand Down Expand Up @@ -38,6 +45,14 @@ import { MessageIn, MessageInSerializer } from "../models/messageIn";
{% endif -%}
{% endfor -%}

{% if resource.name == "authentication" %}
/** @deprecated */
export interface AuthenticationDashboardAccessOptions {
idempotencyKey?: string;
}

{% endif -%}

export class {{ resource_type_name }} {
public constructor(private readonly requestCtx: SvixRequestContext) {}

Expand Down
18 changes: 4 additions & 14 deletions kotlin/lib/src/main/kotlin/Authentication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ package com.svix.kotlin
import com.svix.kotlin.models.AppPortalAccessIn
import com.svix.kotlin.models.AppPortalAccessOut
import com.svix.kotlin.models.ApplicationTokenExpireIn
import com.svix.kotlin.models.DashboardAccessOut
import okhttp3.Headers

data class AuthenticationAppPortalAccessOptions(val idempotencyKey: String? = null)

data class AuthenticationExpireAllOptions(val idempotencyKey: String? = null)

data class AuthenticationDashboardAccessOptions(val idempotencyKey: String? = null)

data class AuthenticationLogoutOptions(val idempotencyKey: String? = null)

class Authentication(private val client: SvixHttpClient) {
Expand Down Expand Up @@ -55,23 +52,16 @@ class Authentication(private val client: SvixHttpClient) {
)
}

/**
* DEPRECATED: Please use `app-portal-access` instead.
*
* Use this function to get magic links (and authentication codes) for connecting your users to
* the Consumer Application Portal.
*
* @deprecated
*/
@Deprecated("")
/** @deprecated Please use `appPortalAccess` instead. */
@Deprecated("Please use `appPortalAccess` instead.")
suspend fun dashboardAccess(
appId: String,
options: AuthenticationDashboardAccessOptions = AuthenticationDashboardAccessOptions(),
): DashboardAccessOut {
): com.svix.kotlin.models.DashboardAccessOut {
val url = client.newUrlBuilder().encodedPath("/api/v1/auth/dashboard-access/$appId")
val headers = Headers.Builder()
options.idempotencyKey?.let { headers.add("idempotency-key", it) }
return client.executeRequest<Any, DashboardAccessOut>(
return client.executeRequest<Any, com.svix.kotlin.models.DashboardAccessOut>(
"POST",
url.build(),
headers = headers.build(),
Expand Down
4 changes: 4 additions & 0 deletions kotlin/lib/src/main/kotlin/Deprecated.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.svix.kotlin

@Deprecated("Only used for deprecated method")
data class AuthenticationDashboardAccessOptions(val idempotencyKey: String? = null)
15 changes: 15 additions & 0 deletions kotlin/templates/api_extra/authentication_expire_all.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** @deprecated Please use `appPortalAccess` instead. */
@Deprecated("Please use `appPortalAccess` instead.")
suspend fun dashboardAccess(
appId: String,
options: AuthenticationDashboardAccessOptions = AuthenticationDashboardAccessOptions(),
): com.svix.kotlin.models.DashboardAccessOut {
val url = client.newUrlBuilder().encodedPath("/api/v1/auth/dashboard-access/$appId")
val headers = Headers.Builder()
options.idempotencyKey?.let { headers.add("idempotency-key", it) }
return client.executeRequest<Any, com.svix.kotlin.models.DashboardAccessOut>(
"POST",
url.build(),
headers = headers.build(),
)
}
Loading