// Code generated by openapi-nexus. DO NOT EDIT.
//
// Duplicate Parameter Names Test API — 1.0.0
// Test API with duplicate parameter names across different locations
package com.example.sdk.runtime;
import okhttp3.Request;
public class ApiKeyAuth implements Authenticator {
private final String key;
private final String name;
private final ApiKeyLocation location;
public ApiKeyAuth(String key, String name, ApiKeyLocation location) {
this.key = key;
this.name = name;
this.location = location;
}
@Override
public void authenticate(Request.Builder builder) {
if (location == ApiKeyLocation.HEADER) {
builder.header(name, key);
} else if (location == ApiKeyLocation.QUERY) {
builder.url(builder.build().url().newBuilder()
.addQueryParameter(name, key)
.build());
}
}
}