frontend vibecoded chnages
This commit is contained in:
Generated
-9
@@ -11,15 +11,6 @@
|
|||||||
<entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.46/lombok-1.18.46.jar" />
|
<entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.46/lombok-1.18.46.jar" />
|
||||||
</processorPath>
|
</processorPath>
|
||||||
<module name="musix" />
|
<module name="musix" />
|
||||||
</profile>
|
|
||||||
<profile name="Annotation profile for mpv-client" enabled="true">
|
|
||||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
|
||||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
|
||||||
<outputRelativeToContentRoot value="true" />
|
|
||||||
<processorPath useClasspath="false">
|
|
||||||
<entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.46/lombok-1.18.46.jar" />
|
|
||||||
<entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.46/lombok-1.18.46.jar" />
|
|
||||||
</processorPath>
|
|
||||||
<module name="mpv-client" />
|
<module name="mpv-client" />
|
||||||
</profile>
|
</profile>
|
||||||
</annotationProcessing>
|
</annotationProcessing>
|
||||||
|
|||||||
Generated
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/musix.iml" filepath="$PROJECT_DIR$/.idea/musix.iml" />
|
<module fileurl="file://$PROJECT_DIR$/musix/musix.iml" filepath="$PROJECT_DIR$/musix/musix.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
Generated
-6
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
/* @ts-nocheck */
|
||||||
|
/* eslint-disable */
|
||||||
|
/* @noformat */
|
||||||
|
/* @formatter:off */
|
||||||
|
/**
|
||||||
|
* Generated by ng-openapi
|
||||||
|
* Entrypoint for the client
|
||||||
|
* Do not edit this file manually
|
||||||
|
*/
|
||||||
|
export * from "./models";
|
||||||
|
export * from "./tokens";
|
||||||
|
export * from "./providers";
|
||||||
|
export * from "./services";
|
||||||
|
export * from "./utils/file-download";
|
||||||
|
export * from "./utils/http-params-builder";
|
||||||
|
export * from "./utils/date-transformer";
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
/* @ts-nocheck */
|
||||||
|
/* eslint-disable */
|
||||||
|
/* @noformat */
|
||||||
|
/* @formatter:off */
|
||||||
|
/**
|
||||||
|
* Generated by ng-openapi
|
||||||
|
* Generated TypeScript interfaces from Swagger specification
|
||||||
|
* Do not edit this file manually
|
||||||
|
*/
|
||||||
|
import { HttpContext, HttpHeaders } from "@angular/common/http";
|
||||||
|
export interface Album {
|
||||||
|
id?: string;
|
||||||
|
name?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Artist {
|
||||||
|
id?: string;
|
||||||
|
name?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MusicRecord {
|
||||||
|
category?: string;
|
||||||
|
resultType?: string;
|
||||||
|
title?: string;
|
||||||
|
videoId?: string;
|
||||||
|
duration_seconds?: string;
|
||||||
|
duration?: string;
|
||||||
|
year?: string;
|
||||||
|
views?: string;
|
||||||
|
album?: Album;
|
||||||
|
artists?: Array<Artist>;
|
||||||
|
thumbnails?: Array<Thumbnails>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Thumbnails {
|
||||||
|
url?: string;
|
||||||
|
width?: number;
|
||||||
|
height?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface User {
|
||||||
|
userId?: string;
|
||||||
|
nickName?: string;
|
||||||
|
popped?: Array<MusicRecord>;
|
||||||
|
musicQueue?: Array<MusicRecord>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QueryDto {
|
||||||
|
queryString?: string;
|
||||||
|
filter?: 'ALBUMS' | 'ARTISTS' | 'PLAYLISTS' | 'COMMUNITY_PLAYLISTS' | 'FEATURED_PLALISTS' | 'VIDEOS' | 'PROFILES' | 'PODCASTS' | 'EPISODES' | 'SONGS' | 'NONE';
|
||||||
|
limit?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateUserRequest {
|
||||||
|
userId?: string;
|
||||||
|
nickName?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ClientRegistrationRequestDto {
|
||||||
|
host?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Client {
|
||||||
|
id?: string;
|
||||||
|
host?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Session {
|
||||||
|
sessionId?: string;
|
||||||
|
currentUserIndex?: number;
|
||||||
|
currentMusicRecord?: MusicRecord;
|
||||||
|
sessionQueue?: Array<SessionQueueElement>;
|
||||||
|
users?: Array<User>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SessionQueueElement {
|
||||||
|
userName?: string;
|
||||||
|
musicRecord?: MusicRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Request Options for Angular HttpClient requests */
|
||||||
|
export interface RequestOptions<TResponseType extends 'arraybuffer' | 'blob' | 'json' | 'text'> {
|
||||||
|
headers?: HttpHeaders;
|
||||||
|
reportProgress?: boolean;
|
||||||
|
responseType?: TResponseType;
|
||||||
|
withCredentials?: boolean;
|
||||||
|
context?: HttpContext;
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
/* @ts-nocheck */
|
||||||
|
/* eslint-disable */
|
||||||
|
/* @noformat */
|
||||||
|
/* @formatter:off */
|
||||||
|
/**
|
||||||
|
* Generated by ng-openapi
|
||||||
|
* Generated provider functions for easy setup
|
||||||
|
* Do not edit this file manually
|
||||||
|
*/
|
||||||
|
import { EnvironmentProviders, Provider, makeEnvironmentProviders } from "@angular/core";
|
||||||
|
import { HTTP_INTERCEPTORS, HttpInterceptor } from "@angular/common/http";
|
||||||
|
import { BASE_PATH_DEFAULT, HTTP_INTERCEPTORS_DEFAULT } from "./tokens";
|
||||||
|
import { DefaultBaseInterceptor } from "./utils/base-interceptor";
|
||||||
|
import { DateInterceptor } from "./utils/date-transformer";
|
||||||
|
|
||||||
|
/** Configuration options for default client */
|
||||||
|
export interface DefaultConfig {
|
||||||
|
/** Base API URL */
|
||||||
|
basePath: string;
|
||||||
|
/** Enable automatic date transformation (default: true) */
|
||||||
|
enableDateTransform?: boolean;
|
||||||
|
/** Array of HTTP interceptor classes to apply to this client */
|
||||||
|
interceptors?: (new (...args: HttpInterceptor[]) => HttpInterceptor)[];
|
||||||
|
/** Override the pattern used to detect ISO date strings during date transformation. */
|
||||||
|
/** Defaults to the generated ISO_DATE_REGEX. */
|
||||||
|
dateTransformRegex?: RegExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Provides configuration for default client */
|
||||||
|
/** */
|
||||||
|
/** @example */
|
||||||
|
/** ```typescript */
|
||||||
|
/** // In your app.config.ts */
|
||||||
|
/** import { provideDefaultClient } from './api/providers'; */
|
||||||
|
/** */
|
||||||
|
/** export const appConfig: ApplicationConfig = { */
|
||||||
|
/** providers: [ */
|
||||||
|
/** provideDefaultClient({ */
|
||||||
|
/** basePath: 'https://api.example.com', */
|
||||||
|
/** interceptors: [AuthInterceptor, LoggingInterceptor] // Classes, not instances */
|
||||||
|
/** }), */
|
||||||
|
/** // other providers... */
|
||||||
|
/** ] */
|
||||||
|
/** }; */
|
||||||
|
/** ``` */
|
||||||
|
export function provideDefaultClient(config: DefaultConfig): EnvironmentProviders {
|
||||||
|
|
||||||
|
const providers: Provider[] = [
|
||||||
|
// Base path token for this client
|
||||||
|
{
|
||||||
|
provide: BASE_PATH_DEFAULT,
|
||||||
|
useValue: config.basePath
|
||||||
|
},
|
||||||
|
// Base interceptor that handles client-specific interceptors
|
||||||
|
{
|
||||||
|
provide: HTTP_INTERCEPTORS,
|
||||||
|
useClass: DefaultBaseInterceptor,
|
||||||
|
multi: true
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// Add client-specific interceptor instances
|
||||||
|
if (config.interceptors && config.interceptors.length > 0) {
|
||||||
|
const interceptorInstances = config.interceptors.map(InterceptorClass => new InterceptorClass());
|
||||||
|
|
||||||
|
// Add date interceptor if enabled (default: true)
|
||||||
|
if (config.enableDateTransform !== false) {
|
||||||
|
interceptorInstances.unshift(new DateInterceptor(config.dateTransformRegex));
|
||||||
|
}
|
||||||
|
|
||||||
|
providers.push({
|
||||||
|
provide: HTTP_INTERCEPTORS_DEFAULT,
|
||||||
|
useValue: interceptorInstances
|
||||||
|
});
|
||||||
|
} else if (config.enableDateTransform !== false) {
|
||||||
|
// Only date interceptor enabled
|
||||||
|
providers.push({
|
||||||
|
provide: HTTP_INTERCEPTORS_DEFAULT,
|
||||||
|
useValue: [new DateInterceptor(config.dateTransformRegex)]
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// No interceptors
|
||||||
|
providers.push({
|
||||||
|
provide: HTTP_INTERCEPTORS_DEFAULT,
|
||||||
|
useValue: []
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return makeEnvironmentProviders(providers);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @deprecated Use provideDefaultClient instead for better clarity */
|
||||||
|
/** Provides configuration for the default client */
|
||||||
|
export function provideNgOpenapi(config: DefaultConfig): EnvironmentProviders {
|
||||||
|
return provideDefaultClient(config);
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/* @ts-nocheck */
|
||||||
|
/* eslint-disable */
|
||||||
|
/* @noformat */
|
||||||
|
/* @formatter:off */
|
||||||
|
/**
|
||||||
|
* Generated by ng-openapi
|
||||||
|
* Generated Angular service for ClientController controller
|
||||||
|
* Do not edit this file manually
|
||||||
|
*/
|
||||||
|
import { HttpClient, HttpContext, HttpContextToken, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from "@angular/common/http";
|
||||||
|
import { inject, Injectable } from "@angular/core";
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
import { BASE_PATH_DEFAULT, CLIENT_CONTEXT_TOKEN_DEFAULT } from "../tokens";
|
||||||
|
import { HttpParamsBuilder } from "../utils/http-params-builder";
|
||||||
|
import { ClientRegistrationRequestDto, RequestOptions, Client } from "../models";
|
||||||
|
|
||||||
|
@Injectable({ providedIn: "root" })
|
||||||
|
export class ClientControllerService {
|
||||||
|
private readonly httpClient: HttpClient = inject(HttpClient);
|
||||||
|
private readonly basePath: string = inject(BASE_PATH_DEFAULT);
|
||||||
|
private readonly clientContextToken: HttpContextToken<string> = CLIENT_CONTEXT_TOKEN_DEFAULT;
|
||||||
|
|
||||||
|
private createContextWithClientId(existingContext?: HttpContext): HttpContext {
|
||||||
|
const context = existingContext || new HttpContext();
|
||||||
|
return context.set(this.clientContextToken, 'default');
|
||||||
|
}
|
||||||
|
|
||||||
|
registerClient(clientRegistrationRequestDto: ClientRegistrationRequestDto, observe?: 'body', options?: RequestOptions<'json'>): Observable<Client>;
|
||||||
|
registerClient(clientRegistrationRequestDto: ClientRegistrationRequestDto, observe?: 'response', options?: RequestOptions<'json'>): Observable<HttpResponse<Client>>;
|
||||||
|
registerClient(clientRegistrationRequestDto: ClientRegistrationRequestDto, observe?: 'events', options?: RequestOptions<'json'>): Observable<HttpEvent<Client>>;
|
||||||
|
registerClient(clientRegistrationRequestDto: ClientRegistrationRequestDto, observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable<any> {
|
||||||
|
const url = `${this.basePath}/api/client/register`;
|
||||||
|
|
||||||
|
let headers: HttpHeaders;
|
||||||
|
if (options?.headers instanceof HttpHeaders) {
|
||||||
|
headers = options.headers;
|
||||||
|
} else {
|
||||||
|
headers = new HttpHeaders(options?.headers);
|
||||||
|
}
|
||||||
|
// Advertise the response content type declared in the spec
|
||||||
|
if (!headers.has('Accept')) {
|
||||||
|
headers = headers.set('Accept', 'application/json');
|
||||||
|
}
|
||||||
|
// Set Content-Type for JSON requests if not already set
|
||||||
|
if (!headers.has('Content-Type')) {
|
||||||
|
headers = headers.set('Content-Type', 'application/json');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.httpClient.request('post', url, {
|
||||||
|
body: clientRegistrationRequestDto,
|
||||||
|
observe,
|
||||||
|
headers,
|
||||||
|
reportProgress: options?.reportProgress,
|
||||||
|
withCredentials: options?.withCredentials,
|
||||||
|
context: this.createContextWithClientId(options?.context)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/* @ts-nocheck */
|
||||||
|
/* eslint-disable */
|
||||||
|
/* @noformat */
|
||||||
|
/* @formatter:off */
|
||||||
|
/**
|
||||||
|
* Generated by ng-openapi
|
||||||
|
* Generated Angular service for HealthController controller
|
||||||
|
* Do not edit this file manually
|
||||||
|
*/
|
||||||
|
import { HttpClient, HttpContext, HttpContextToken, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from "@angular/common/http";
|
||||||
|
import { inject, Injectable } from "@angular/core";
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
import { BASE_PATH_DEFAULT, CLIENT_CONTEXT_TOKEN_DEFAULT } from "../tokens";
|
||||||
|
import { HttpParamsBuilder } from "../utils/http-params-builder";
|
||||||
|
import { RequestOptions } from "../models";
|
||||||
|
|
||||||
|
@Injectable({ providedIn: "root" })
|
||||||
|
export class HealthControllerService {
|
||||||
|
private readonly httpClient: HttpClient = inject(HttpClient);
|
||||||
|
private readonly basePath: string = inject(BASE_PATH_DEFAULT);
|
||||||
|
private readonly clientContextToken: HttpContextToken<string> = CLIENT_CONTEXT_TOKEN_DEFAULT;
|
||||||
|
|
||||||
|
private createContextWithClientId(existingContext?: HttpContext): HttpContext {
|
||||||
|
const context = existingContext || new HttpContext();
|
||||||
|
return context.set(this.clientContextToken, 'default');
|
||||||
|
}
|
||||||
|
|
||||||
|
ping(observe?: 'body', options?: RequestOptions<'text'>): Observable<string>;
|
||||||
|
ping(observe?: 'response', options?: RequestOptions<'text'>): Observable<HttpResponse<string>>;
|
||||||
|
ping(observe?: 'events', options?: RequestOptions<'text'>): Observable<HttpEvent<string>>;
|
||||||
|
ping(observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable<any> {
|
||||||
|
const url = `${this.basePath}/health/ping`;
|
||||||
|
|
||||||
|
let headers: HttpHeaders;
|
||||||
|
if (options?.headers instanceof HttpHeaders) {
|
||||||
|
headers = options.headers;
|
||||||
|
} else {
|
||||||
|
headers = new HttpHeaders(options?.headers);
|
||||||
|
}
|
||||||
|
// Advertise the response content type declared in the spec
|
||||||
|
if (!headers.has('Accept')) {
|
||||||
|
headers = headers.set('Accept', 'application/json');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.httpClient.request('get', url, {
|
||||||
|
observe,
|
||||||
|
headers,
|
||||||
|
responseType: 'text',
|
||||||
|
reportProgress: options?.reportProgress,
|
||||||
|
withCredentials: options?.withCredentials,
|
||||||
|
context: this.createContextWithClientId(options?.context)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/* @ts-nocheck */
|
||||||
|
/* eslint-disable */
|
||||||
|
/* @noformat */
|
||||||
|
/* @formatter:off */
|
||||||
|
/**
|
||||||
|
* Generated by ng-openapi
|
||||||
|
* Generated service exports
|
||||||
|
* Do not edit this file manually
|
||||||
|
*/
|
||||||
|
export { ClientControllerService } from "./clientController.service";
|
||||||
|
export { HealthControllerService } from "./healthController.service";
|
||||||
|
export { PlayerControllerService } from "./playerController.service";
|
||||||
|
export { SessionControllerService } from "./sessionController.service";
|
||||||
|
export { UserControllerService } from "./userController.service";
|
||||||
|
export { YoutubeControllerService } from "./youtubeController.service";
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/* @ts-nocheck */
|
||||||
|
/* eslint-disable */
|
||||||
|
/* @noformat */
|
||||||
|
/* @formatter:off */
|
||||||
|
/**
|
||||||
|
* Generated by ng-openapi
|
||||||
|
* Generated Angular service for PlayerController controller
|
||||||
|
* Do not edit this file manually
|
||||||
|
*/
|
||||||
|
import { HttpClient, HttpContext, HttpContextToken, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from "@angular/common/http";
|
||||||
|
import { inject, Injectable } from "@angular/core";
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
import { BASE_PATH_DEFAULT, CLIENT_CONTEXT_TOKEN_DEFAULT } from "../tokens";
|
||||||
|
import { HttpParamsBuilder } from "../utils/http-params-builder";
|
||||||
|
import { RequestOptions } from "../models";
|
||||||
|
|
||||||
|
@Injectable({ providedIn: "root" })
|
||||||
|
export class PlayerControllerService {
|
||||||
|
private readonly httpClient: HttpClient = inject(HttpClient);
|
||||||
|
private readonly basePath: string = inject(BASE_PATH_DEFAULT);
|
||||||
|
private readonly clientContextToken: HttpContextToken<string> = CLIENT_CONTEXT_TOKEN_DEFAULT;
|
||||||
|
|
||||||
|
private createContextWithClientId(existingContext?: HttpContext): HttpContext {
|
||||||
|
const context = existingContext || new HttpContext();
|
||||||
|
return context.set(this.clientContextToken, 'default');
|
||||||
|
}
|
||||||
|
|
||||||
|
play(id: string, observe?: 'body', options?: RequestOptions<'text'>): Observable<string>;
|
||||||
|
play(id: string, observe?: 'response', options?: RequestOptions<'text'>): Observable<HttpResponse<string>>;
|
||||||
|
play(id: string, observe?: 'events', options?: RequestOptions<'text'>): Observable<HttpEvent<string>>;
|
||||||
|
play(id: string, observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable<any> {
|
||||||
|
const url = `${this.basePath}/api/player/play/${id}`;
|
||||||
|
|
||||||
|
let headers: HttpHeaders;
|
||||||
|
if (options?.headers instanceof HttpHeaders) {
|
||||||
|
headers = options.headers;
|
||||||
|
} else {
|
||||||
|
headers = new HttpHeaders(options?.headers);
|
||||||
|
}
|
||||||
|
// Advertise the response content type declared in the spec
|
||||||
|
if (!headers.has('Accept')) {
|
||||||
|
headers = headers.set('Accept', 'application/json');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.httpClient.request('post', url, {
|
||||||
|
body: null,
|
||||||
|
observe,
|
||||||
|
headers,
|
||||||
|
responseType: 'text',
|
||||||
|
reportProgress: options?.reportProgress,
|
||||||
|
withCredentials: options?.withCredentials,
|
||||||
|
context: this.createContextWithClientId(options?.context)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
/* @ts-nocheck */
|
||||||
|
/* eslint-disable */
|
||||||
|
/* @noformat */
|
||||||
|
/* @formatter:off */
|
||||||
|
/**
|
||||||
|
* Generated by ng-openapi
|
||||||
|
* Generated Angular service for SessionController controller
|
||||||
|
* Do not edit this file manually
|
||||||
|
*/
|
||||||
|
import { HttpClient, HttpContext, HttpContextToken, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from "@angular/common/http";
|
||||||
|
import { inject, Injectable } from "@angular/core";
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
import { BASE_PATH_DEFAULT, CLIENT_CONTEXT_TOKEN_DEFAULT } from "../tokens";
|
||||||
|
import { HttpParamsBuilder } from "../utils/http-params-builder";
|
||||||
|
import { RequestOptions, User, Session } from "../models";
|
||||||
|
|
||||||
|
@Injectable({ providedIn: "root" })
|
||||||
|
export class SessionControllerService {
|
||||||
|
private readonly httpClient: HttpClient = inject(HttpClient);
|
||||||
|
private readonly basePath: string = inject(BASE_PATH_DEFAULT);
|
||||||
|
private readonly clientContextToken: HttpContextToken<string> = CLIENT_CONTEXT_TOKEN_DEFAULT;
|
||||||
|
|
||||||
|
private createContextWithClientId(existingContext?: HttpContext): HttpContext {
|
||||||
|
const context = existingContext || new HttpContext();
|
||||||
|
return context.set(this.clientContextToken, 'default');
|
||||||
|
}
|
||||||
|
|
||||||
|
addMusic(musicId: string, observe?: 'body', options?: RequestOptions<'json'>): Observable<User>;
|
||||||
|
addMusic(musicId: string, observe?: 'response', options?: RequestOptions<'json'>): Observable<HttpResponse<User>>;
|
||||||
|
addMusic(musicId: string, observe?: 'events', options?: RequestOptions<'json'>): Observable<HttpEvent<User>>;
|
||||||
|
addMusic(musicId: string, observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable<any> {
|
||||||
|
const url = `${this.basePath}/session/music/add/${musicId}`;
|
||||||
|
|
||||||
|
let headers: HttpHeaders;
|
||||||
|
if (options?.headers instanceof HttpHeaders) {
|
||||||
|
headers = options.headers;
|
||||||
|
} else {
|
||||||
|
headers = new HttpHeaders(options?.headers);
|
||||||
|
}
|
||||||
|
// Advertise the response content type declared in the spec
|
||||||
|
if (!headers.has('Accept')) {
|
||||||
|
headers = headers.set('Accept', 'application/json');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.httpClient.request('post', url, {
|
||||||
|
body: null,
|
||||||
|
observe,
|
||||||
|
headers,
|
||||||
|
reportProgress: options?.reportProgress,
|
||||||
|
withCredentials: options?.withCredentials,
|
||||||
|
context: this.createContextWithClientId(options?.context)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getSession(observe?: 'body', options?: RequestOptions<'json'>): Observable<Session>;
|
||||||
|
getSession(observe?: 'response', options?: RequestOptions<'json'>): Observable<HttpResponse<Session>>;
|
||||||
|
getSession(observe?: 'events', options?: RequestOptions<'json'>): Observable<HttpEvent<Session>>;
|
||||||
|
getSession(observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable<any> {
|
||||||
|
const url = `${this.basePath}/session`;
|
||||||
|
|
||||||
|
let headers: HttpHeaders;
|
||||||
|
if (options?.headers instanceof HttpHeaders) {
|
||||||
|
headers = options.headers;
|
||||||
|
} else {
|
||||||
|
headers = new HttpHeaders(options?.headers);
|
||||||
|
}
|
||||||
|
// Advertise the response content type declared in the spec
|
||||||
|
if (!headers.has('Accept')) {
|
||||||
|
headers = headers.set('Accept', 'application/json');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.httpClient.request('get', url, {
|
||||||
|
observe,
|
||||||
|
headers,
|
||||||
|
reportProgress: options?.reportProgress,
|
||||||
|
withCredentials: options?.withCredentials,
|
||||||
|
context: this.createContextWithClientId(options?.context)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
playNext(observe?: 'body', options?: RequestOptions<'json'>): Observable<Session>;
|
||||||
|
playNext(observe?: 'response', options?: RequestOptions<'json'>): Observable<HttpResponse<Session>>;
|
||||||
|
playNext(observe?: 'events', options?: RequestOptions<'json'>): Observable<HttpEvent<Session>>;
|
||||||
|
playNext(observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable<any> {
|
||||||
|
const url = `${this.basePath}/session/testing/play/next`;
|
||||||
|
|
||||||
|
let headers: HttpHeaders;
|
||||||
|
if (options?.headers instanceof HttpHeaders) {
|
||||||
|
headers = options.headers;
|
||||||
|
} else {
|
||||||
|
headers = new HttpHeaders(options?.headers);
|
||||||
|
}
|
||||||
|
// Advertise the response content type declared in the spec
|
||||||
|
if (!headers.has('Accept')) {
|
||||||
|
headers = headers.set('Accept', 'application/json');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.httpClient.request('get', url, {
|
||||||
|
observe,
|
||||||
|
headers,
|
||||||
|
reportProgress: options?.reportProgress,
|
||||||
|
withCredentials: options?.withCredentials,
|
||||||
|
context: this.createContextWithClientId(options?.context)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
nextUser(observe?: 'body', options?: RequestOptions<'json'>): Observable<Session>;
|
||||||
|
nextUser(observe?: 'response', options?: RequestOptions<'json'>): Observable<HttpResponse<Session>>;
|
||||||
|
nextUser(observe?: 'events', options?: RequestOptions<'json'>): Observable<HttpEvent<Session>>;
|
||||||
|
nextUser(observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable<any> {
|
||||||
|
const url = `${this.basePath}/session/testing/next/user`;
|
||||||
|
|
||||||
|
let headers: HttpHeaders;
|
||||||
|
if (options?.headers instanceof HttpHeaders) {
|
||||||
|
headers = options.headers;
|
||||||
|
} else {
|
||||||
|
headers = new HttpHeaders(options?.headers);
|
||||||
|
}
|
||||||
|
// Advertise the response content type declared in the spec
|
||||||
|
if (!headers.has('Accept')) {
|
||||||
|
headers = headers.set('Accept', 'application/json');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.httpClient.request('get', url, {
|
||||||
|
observe,
|
||||||
|
headers,
|
||||||
|
reportProgress: options?.reportProgress,
|
||||||
|
withCredentials: options?.withCredentials,
|
||||||
|
context: this.createContextWithClientId(options?.context)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/* @ts-nocheck */
|
||||||
|
/* eslint-disable */
|
||||||
|
/* @noformat */
|
||||||
|
/* @formatter:off */
|
||||||
|
/**
|
||||||
|
* Generated by ng-openapi
|
||||||
|
* Generated Angular service for UserController controller
|
||||||
|
* Do not edit this file manually
|
||||||
|
*/
|
||||||
|
import { HttpClient, HttpContext, HttpContextToken, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from "@angular/common/http";
|
||||||
|
import { inject, Injectable } from "@angular/core";
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
import { BASE_PATH_DEFAULT, CLIENT_CONTEXT_TOKEN_DEFAULT } from "../tokens";
|
||||||
|
import { HttpParamsBuilder } from "../utils/http-params-builder";
|
||||||
|
import { CreateUserRequest, RequestOptions, User } from "../models";
|
||||||
|
|
||||||
|
@Injectable({ providedIn: "root" })
|
||||||
|
export class UserControllerService {
|
||||||
|
private readonly httpClient: HttpClient = inject(HttpClient);
|
||||||
|
private readonly basePath: string = inject(BASE_PATH_DEFAULT);
|
||||||
|
private readonly clientContextToken: HttpContextToken<string> = CLIENT_CONTEXT_TOKEN_DEFAULT;
|
||||||
|
|
||||||
|
private createContextWithClientId(existingContext?: HttpContext): HttpContext {
|
||||||
|
const context = existingContext || new HttpContext();
|
||||||
|
return context.set(this.clientContextToken, 'default');
|
||||||
|
}
|
||||||
|
|
||||||
|
createUser(createUserRequest: CreateUserRequest, observe?: 'body', options?: RequestOptions<'json'>): Observable<Array<User>>;
|
||||||
|
createUser(createUserRequest: CreateUserRequest, observe?: 'response', options?: RequestOptions<'json'>): Observable<HttpResponse<Array<User>>>;
|
||||||
|
createUser(createUserRequest: CreateUserRequest, observe?: 'events', options?: RequestOptions<'json'>): Observable<HttpEvent<Array<User>>>;
|
||||||
|
createUser(createUserRequest: CreateUserRequest, observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable<any> {
|
||||||
|
const url = `${this.basePath}/api/user`;
|
||||||
|
|
||||||
|
let headers: HttpHeaders;
|
||||||
|
if (options?.headers instanceof HttpHeaders) {
|
||||||
|
headers = options.headers;
|
||||||
|
} else {
|
||||||
|
headers = new HttpHeaders(options?.headers);
|
||||||
|
}
|
||||||
|
// Advertise the response content type declared in the spec
|
||||||
|
if (!headers.has('Accept')) {
|
||||||
|
headers = headers.set('Accept', 'application/json');
|
||||||
|
}
|
||||||
|
// Set Content-Type for JSON requests if not already set
|
||||||
|
if (!headers.has('Content-Type')) {
|
||||||
|
headers = headers.set('Content-Type', 'application/json');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.httpClient.request('post', url, {
|
||||||
|
body: createUserRequest,
|
||||||
|
observe,
|
||||||
|
headers,
|
||||||
|
reportProgress: options?.reportProgress,
|
||||||
|
withCredentials: options?.withCredentials,
|
||||||
|
context: this.createContextWithClientId(options?.context)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/* @ts-nocheck */
|
||||||
|
/* eslint-disable */
|
||||||
|
/* @noformat */
|
||||||
|
/* @formatter:off */
|
||||||
|
/**
|
||||||
|
* Generated by ng-openapi
|
||||||
|
* Generated Angular service for YoutubeController controller
|
||||||
|
* Do not edit this file manually
|
||||||
|
*/
|
||||||
|
import { HttpClient, HttpContext, HttpContextToken, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from "@angular/common/http";
|
||||||
|
import { inject, Injectable } from "@angular/core";
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
import { BASE_PATH_DEFAULT, CLIENT_CONTEXT_TOKEN_DEFAULT } from "../tokens";
|
||||||
|
import { HttpParamsBuilder } from "../utils/http-params-builder";
|
||||||
|
import { QueryDto, RequestOptions, MusicRecord } from "../models";
|
||||||
|
|
||||||
|
@Injectable({ providedIn: "root" })
|
||||||
|
export class YoutubeControllerService {
|
||||||
|
private readonly httpClient: HttpClient = inject(HttpClient);
|
||||||
|
private readonly basePath: string = inject(BASE_PATH_DEFAULT);
|
||||||
|
private readonly clientContextToken: HttpContextToken<string> = CLIENT_CONTEXT_TOKEN_DEFAULT;
|
||||||
|
|
||||||
|
private createContextWithClientId(existingContext?: HttpContext): HttpContext {
|
||||||
|
const context = existingContext || new HttpContext();
|
||||||
|
return context.set(this.clientContextToken, 'default');
|
||||||
|
}
|
||||||
|
|
||||||
|
query(queryDto: QueryDto, observe?: 'body', options?: RequestOptions<'json'>): Observable<Array<MusicRecord>>;
|
||||||
|
query(queryDto: QueryDto, observe?: 'response', options?: RequestOptions<'json'>): Observable<HttpResponse<Array<MusicRecord>>>;
|
||||||
|
query(queryDto: QueryDto, observe?: 'events', options?: RequestOptions<'json'>): Observable<HttpEvent<Array<MusicRecord>>>;
|
||||||
|
query(queryDto: QueryDto, observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable<any> {
|
||||||
|
const url = `${this.basePath}/api/youtube/query`;
|
||||||
|
|
||||||
|
let headers: HttpHeaders;
|
||||||
|
if (options?.headers instanceof HttpHeaders) {
|
||||||
|
headers = options.headers;
|
||||||
|
} else {
|
||||||
|
headers = new HttpHeaders(options?.headers);
|
||||||
|
}
|
||||||
|
// Advertise the response content type declared in the spec
|
||||||
|
if (!headers.has('Accept')) {
|
||||||
|
headers = headers.set('Accept', 'application/json');
|
||||||
|
}
|
||||||
|
// Set Content-Type for JSON requests if not already set
|
||||||
|
if (!headers.has('Content-Type')) {
|
||||||
|
headers = headers.set('Content-Type', 'application/json');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.httpClient.request('post', url, {
|
||||||
|
body: queryDto,
|
||||||
|
observe,
|
||||||
|
headers,
|
||||||
|
reportProgress: options?.reportProgress,
|
||||||
|
withCredentials: options?.withCredentials,
|
||||||
|
context: this.createContextWithClientId(options?.context)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { InjectionToken } from "@angular/core";
|
||||||
|
import { HttpInterceptor, HttpContextToken } from "@angular/common/http";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Injection token for the default client base API path
|
||||||
|
*/
|
||||||
|
export const BASE_PATH_DEFAULT = new InjectionToken<string>('BASE_PATH_DEFAULT', {
|
||||||
|
providedIn: 'root',
|
||||||
|
factory: () => '/api', // Default fallback
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* Injection token for the default client HTTP interceptor instances
|
||||||
|
*/
|
||||||
|
export const HTTP_INTERCEPTORS_DEFAULT = new InjectionToken<HttpInterceptor[]>('HTTP_INTERCEPTORS_DEFAULT', {
|
||||||
|
providedIn: 'root',
|
||||||
|
factory: () => [], // Default empty array
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* HttpContext token to identify requests belonging to the default client
|
||||||
|
*/
|
||||||
|
export const CLIENT_CONTEXT_TOKEN_DEFAULT = new HttpContextToken<string>(() => 'default');
|
||||||
|
/**
|
||||||
|
* @deprecated Use BASE_PATH_DEFAULT instead
|
||||||
|
*/
|
||||||
|
export const BASE_PATH = BASE_PATH_DEFAULT;
|
||||||
|
/**
|
||||||
|
* @deprecated Use CLIENT_CONTEXT_TOKEN_DEFAULT instead
|
||||||
|
*/
|
||||||
|
export const CLIENT_CONTEXT_TOKEN = CLIENT_CONTEXT_TOKEN_DEFAULT;
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/* @ts-nocheck */
|
||||||
|
/* eslint-disable */
|
||||||
|
/* @noformat */
|
||||||
|
/* @formatter:off */
|
||||||
|
/**
|
||||||
|
* Generated by ng-openapi
|
||||||
|
* Generated Base Interceptor for client default
|
||||||
|
* Do not edit this file manually
|
||||||
|
*/
|
||||||
|
import { HttpContextToken, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from "@angular/common/http";
|
||||||
|
import { inject, Injectable } from "@angular/core";
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
import { CLIENT_CONTEXT_TOKEN_DEFAULT, HTTP_INTERCEPTORS_DEFAULT } from "../tokens";
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class DefaultBaseInterceptor implements HttpInterceptor {
|
||||||
|
private readonly httpInterceptors: HttpInterceptor[] = inject(HTTP_INTERCEPTORS_DEFAULT);
|
||||||
|
private readonly clientContextToken: HttpContextToken<string> = CLIENT_CONTEXT_TOKEN_DEFAULT;
|
||||||
|
|
||||||
|
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||||
|
|
||||||
|
// Check if this request belongs to this client using HttpContext
|
||||||
|
if (!req.context.has(this.clientContextToken)) {
|
||||||
|
// This request doesn't belong to this client, pass it through
|
||||||
|
return next.handle(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply client-specific interceptors in reverse order
|
||||||
|
let handler = next;
|
||||||
|
|
||||||
|
handler = this.httpInterceptors.reduceRight(
|
||||||
|
(next, interceptor) => ({
|
||||||
|
handle: (request: HttpRequest<any>) => interceptor.intercept(request, next)
|
||||||
|
}),
|
||||||
|
handler
|
||||||
|
);
|
||||||
|
|
||||||
|
return handler.handle(req);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse } from "@angular/common/http";
|
||||||
|
import { Injectable } from "@angular/core";
|
||||||
|
import { Observable, map } from "rxjs";
|
||||||
|
|
||||||
|
export const ISO_DATE_REGEX = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:?\d{2})?$/;
|
||||||
|
|
||||||
|
export function transformDates(obj: any, dateRegex: RegExp = ISO_DATE_REGEX): any {
|
||||||
|
|
||||||
|
if (obj === null || obj === undefined || typeof obj !== 'object') {
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj instanceof Date) {
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(obj)) {
|
||||||
|
return obj.map(item => transformDates(item, dateRegex));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof obj === 'object') {
|
||||||
|
const transformed: any = {};
|
||||||
|
for (const key of Object.keys(obj)) {
|
||||||
|
const value = obj[key];
|
||||||
|
if (typeof value === 'string' && dateRegex.test(value)) {
|
||||||
|
transformed[key] = new Date(value);
|
||||||
|
} else {
|
||||||
|
transformed[key] = transformDates(value, dateRegex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return transformed;
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class DateInterceptor implements HttpInterceptor {
|
||||||
|
/** @param dateRegex Optional override for the pattern used to detect ISO date strings. */
|
||||||
|
constructor(private readonly dateRegex: RegExp = ISO_DATE_REGEX) {
|
||||||
|
}
|
||||||
|
|
||||||
|
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||||
|
|
||||||
|
return next.handle(req).pipe(
|
||||||
|
map(event => {
|
||||||
|
if (event instanceof HttpResponse && event.body) {
|
||||||
|
return event.clone({ body: transformDates(event.body, this.dateRegex) });
|
||||||
|
}
|
||||||
|
return event;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
import { Observable, tap } from "rxjs";
|
||||||
|
|
||||||
|
export function downloadFile(blob: Blob, filename: string, mimeType?: string): void {
|
||||||
|
|
||||||
|
// Create a temporary URL for the blob
|
||||||
|
const url = window.URL.createObjectURL(blob);
|
||||||
|
|
||||||
|
// Create a temporary anchor element and trigger download
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = url;
|
||||||
|
link.download = filename;
|
||||||
|
|
||||||
|
// Append to body, click, and remove
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
document.body.removeChild(link);
|
||||||
|
|
||||||
|
// Clean up the URL
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function downloadFileOperator<T extends Blob>(filename: string | ((blob: T) => string), mimeType?: string): (source: Observable<T>) => Observable<T> {
|
||||||
|
|
||||||
|
return (source: Observable<T>) => {
|
||||||
|
return source.pipe(
|
||||||
|
tap((blob: T) => {
|
||||||
|
const actualFilename = typeof filename === 'function' ? filename(blob) : filename;
|
||||||
|
downloadFile(blob, actualFilename, mimeType);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function extractFilenameFromContentDisposition(contentDisposition: string | null, fallbackFilename: string = "download"): string {
|
||||||
|
|
||||||
|
if (!contentDisposition) {
|
||||||
|
return fallbackFilename;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to extract filename from Content-Disposition header
|
||||||
|
// Supports both "filename=" and "filename*=" formats
|
||||||
|
const filenameMatch = contentDisposition.match(/filename\*?=['"]?([^'"\n;]+)['"]?/i);
|
||||||
|
|
||||||
|
if (filenameMatch && filenameMatch[1]) {
|
||||||
|
// Decode if it's RFC 5987 encoded (filename*=UTF-8''...)
|
||||||
|
const filename = filenameMatch[1];
|
||||||
|
if (filename.includes("''")) {
|
||||||
|
const parts = filename.split("''");
|
||||||
|
const encoded = parts.length === 2 ? parts[1] : undefined;
|
||||||
|
if (encoded) {
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(encoded);
|
||||||
|
} catch {
|
||||||
|
return encoded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fallbackFilename;
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import { HttpParams } from "@angular/common/http";
|
||||||
|
|
||||||
|
export class HttpParamsBuilder {
|
||||||
|
/** Adds a value to HttpParams. Delegates to recursive handler for objects/arrays. */
|
||||||
|
public static addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||||
|
const isDate = value instanceof Date;
|
||||||
|
const isArray = Array.isArray(value);
|
||||||
|
const isObject = typeof value === "object" && !isDate && !isArray;
|
||||||
|
|
||||||
|
if (isObject) {
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.addToHttpParamsRecursive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||||
|
if (value == null) {
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
return this.handleArray(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value instanceof Date) {
|
||||||
|
return this.handleDate(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof value === "object") {
|
||||||
|
return this.handleObject(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.handlePrimitive(httpParams, value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static handleArray(httpParams: HttpParams, arr: unknown[], key?: string): HttpParams {
|
||||||
|
arr.forEach((element) => {
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, element, key);
|
||||||
|
});
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static handleDate(httpParams: HttpParams, date: Date, key?: string): HttpParams {
|
||||||
|
if (!key) {
|
||||||
|
throw new Error("key may not be null if value is Date");
|
||||||
|
}
|
||||||
|
return httpParams.append(key, date.toISOString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static handleObject(httpParams: HttpParams, obj: Record<string, any>, key?: string): HttpParams {
|
||||||
|
Object.keys(obj).forEach((prop) => {
|
||||||
|
const nestedKey = key ? `${key}.${prop}` : prop;
|
||||||
|
httpParams = this.addToHttpParamsRecursive(httpParams, obj[prop], nestedKey);
|
||||||
|
});
|
||||||
|
return httpParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static handlePrimitive(httpParams: HttpParams, value: string | number | boolean, key?: string): HttpParams {
|
||||||
|
if (!key) {
|
||||||
|
throw new Error("key may not be null if value is primitive");
|
||||||
|
}
|
||||||
|
return httpParams.append(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,15 @@ import { provideRouter } from '@angular/router';
|
|||||||
|
|
||||||
import { routes } from './app.routes';
|
import { routes } from './app.routes';
|
||||||
import { CookieService } from 'ngx-cookie-service';
|
import { CookieService } from 'ngx-cookie-service';
|
||||||
|
import { provideDefaultClient } from './api/providers';
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [provideBrowserGlobalErrorListeners(), provideRouter(routes), CookieService]
|
providers: [
|
||||||
|
provideBrowserGlobalErrorListeners(),
|
||||||
|
provideRouter(routes),
|
||||||
|
CookieService,
|
||||||
|
provideDefaultClient({
|
||||||
|
basePath: 'http://192.168.0.108:8080'
|
||||||
|
})
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
+6
-13
@@ -6,25 +6,21 @@ import { HttpClient } from '@angular/common/http';
|
|||||||
import { CookieService } from 'ngx-cookie-service';
|
import { CookieService } from 'ngx-cookie-service';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import { YoutubeSearchResult } from './youtube-search-result/youtube-search-result';
|
import { YoutubeSearchResult } from './youtube-search-result/youtube-search-result';
|
||||||
import { Session, SessionControllerService } from './core/api';
|
import { Session, SessionControllerService } from './api';
|
||||||
|
import { YoutubeSearchTab } from './youtube-search-tab/youtube-search-tab';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
imports: [MatButtonModule, MatIconModule, MatTabsModule, YoutubeSearchResult],
|
imports: [MatButtonModule, MatIconModule, MatTabsModule, YoutubeSearchTab],
|
||||||
template: `
|
template: `
|
||||||
<mat-tab-group mat-stretch-tabs="false" mat-align-tabs="center">
|
<mat-tab-group mat-stretch-tabs="false" mat-align-tabs="center">
|
||||||
<mat-tab label="Session"></mat-tab>
|
<mat-tab label="Session"></mat-tab>
|
||||||
<mat-tab label="My Queue"></mat-tab>
|
<mat-tab label="My Queue"></mat-tab>
|
||||||
<mat-tab label="Search"></mat-tab>
|
<mat-tab label="Search">
|
||||||
|
<app-youtube-search-tab> </app-youtube-search-tab>
|
||||||
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
|
|
||||||
<app-youtube-search-result></app-youtube-search-result>
|
|
||||||
<app-youtube-search-result></app-youtube-search-result>
|
|
||||||
<app-youtube-search-result></app-youtube-search-result>
|
|
||||||
<app-youtube-search-result></app-youtube-search-result>
|
|
||||||
<app-youtube-search-result></app-youtube-search-result>
|
|
||||||
<app-youtube-search-result></app-youtube-search-result>
|
|
||||||
`,
|
`,
|
||||||
styleUrl: './app.css',
|
styleUrl: './app.css',
|
||||||
})
|
})
|
||||||
@@ -33,7 +29,6 @@ export class App implements OnInit {
|
|||||||
private _sessionService;
|
private _sessionService;
|
||||||
private userIdCookieName = 'userId';
|
private userIdCookieName = 'userId';
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
private cookieService: CookieService,
|
private cookieService: CookieService,
|
||||||
@@ -59,7 +54,5 @@ export class App implements OnInit {
|
|||||||
console.error('Request failed', error);
|
console.error('Request failed', error);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
wwwroot/*.js
|
|
||||||
node_modules
|
|
||||||
typings
|
|
||||||
dist
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
# OpenAPI Generator Ignore
|
|
||||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
||||||
|
|
||||||
# Use this file to prevent files from being overwritten by the generator.
|
|
||||||
# The patterns follow closely to .gitignore or .dockerignore.
|
|
||||||
|
|
||||||
# As an example, the C# client generator defines ApiClient.cs.
|
|
||||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
|
||||||
#ApiClient.cs
|
|
||||||
|
|
||||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
||||||
#foo/*/qux
|
|
||||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
||||||
#foo/**/qux
|
|
||||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can also negate patterns with an exclamation (!).
|
|
||||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
||||||
#docs/*.md
|
|
||||||
# Then explicitly reverse the ignore rule for a single file:
|
|
||||||
#!docs/README.md
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
.gitignore
|
|
||||||
README.md
|
|
||||||
api.base.service.ts
|
|
||||||
api.module.ts
|
|
||||||
api/api.ts
|
|
||||||
api/clientController.service.ts
|
|
||||||
api/healthController.service.ts
|
|
||||||
api/playerController.service.ts
|
|
||||||
api/sessionController.service.ts
|
|
||||||
api/userController.service.ts
|
|
||||||
api/youtubeController.service.ts
|
|
||||||
configuration.ts
|
|
||||||
encoder.ts
|
|
||||||
git_push.sh
|
|
||||||
index.ts
|
|
||||||
model/album.ts
|
|
||||||
model/artist.ts
|
|
||||||
model/client.ts
|
|
||||||
model/clientRegistrationRequestDto.ts
|
|
||||||
model/createUserRequest.ts
|
|
||||||
model/models.ts
|
|
||||||
model/musicRecord.ts
|
|
||||||
model/queryDto.ts
|
|
||||||
model/session.ts
|
|
||||||
model/sessionQueueElement.ts
|
|
||||||
model/thumbnails.ts
|
|
||||||
model/user.ts
|
|
||||||
param.ts
|
|
||||||
provide-api.ts
|
|
||||||
query.params.ts
|
|
||||||
variables.ts
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
7.24.0
|
|
||||||
@@ -1,185 +0,0 @@
|
|||||||
# @
|
|
||||||
|
|
||||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
||||||
|
|
||||||
The version of the OpenAPI document: v0
|
|
||||||
|
|
||||||
## Building
|
|
||||||
|
|
||||||
To install the required dependencies and to build the typescript sources run:
|
|
||||||
|
|
||||||
```console
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
## Publishing
|
|
||||||
|
|
||||||
First build the package then run `npm publish dist` (don't forget to specify the `dist` folder!)
|
|
||||||
|
|
||||||
## Consuming
|
|
||||||
|
|
||||||
Navigate to the folder of your consuming project and run one of next commands.
|
|
||||||
|
|
||||||
_published:_
|
|
||||||
|
|
||||||
```console
|
|
||||||
npm install @ --save
|
|
||||||
```
|
|
||||||
|
|
||||||
_without publishing (not recommended):_
|
|
||||||
|
|
||||||
```console
|
|
||||||
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
|
|
||||||
```
|
|
||||||
|
|
||||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
|
||||||
|
|
||||||
_using `npm link`:_
|
|
||||||
|
|
||||||
In PATH_TO_GENERATED_PACKAGE/dist:
|
|
||||||
|
|
||||||
```console
|
|
||||||
npm link
|
|
||||||
```
|
|
||||||
|
|
||||||
In your project:
|
|
||||||
|
|
||||||
```console
|
|
||||||
npm link
|
|
||||||
```
|
|
||||||
|
|
||||||
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
|
|
||||||
Please refer to this issue <https://github.com/angular/angular-cli/issues/8284> for a solution / workaround.
|
|
||||||
Published packages are not effected by this issue.
|
|
||||||
|
|
||||||
### General usage
|
|
||||||
|
|
||||||
In your Angular project:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
|
|
||||||
import { ApplicationConfig } from '@angular/core';
|
|
||||||
import { provideHttpClient } from '@angular/common/http';
|
|
||||||
import { provideApi } from '';
|
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
|
||||||
providers: [
|
|
||||||
// ...
|
|
||||||
provideHttpClient(),
|
|
||||||
provideApi()
|
|
||||||
],
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
**NOTE**
|
|
||||||
If you're still using `AppModule` and haven't [migrated](https://angular.dev/reference/migrations/standalone) yet, you can still import an Angular module:
|
|
||||||
```typescript
|
|
||||||
import { ApiModule } from '';
|
|
||||||
```
|
|
||||||
|
|
||||||
If different from the generated base path, during app bootstrap, you can provide the base path to your service.
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import { ApplicationConfig } from '@angular/core';
|
|
||||||
import { provideHttpClient } from '@angular/common/http';
|
|
||||||
import { provideApi } from '';
|
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
|
||||||
providers: [
|
|
||||||
// ...
|
|
||||||
provideHttpClient(),
|
|
||||||
provideApi('http://localhost:9999')
|
|
||||||
],
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// with a custom configuration
|
|
||||||
import { ApplicationConfig } from '@angular/core';
|
|
||||||
import { provideHttpClient } from '@angular/common/http';
|
|
||||||
import { provideApi } from '';
|
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
|
||||||
providers: [
|
|
||||||
// ...
|
|
||||||
provideHttpClient(),
|
|
||||||
provideApi({
|
|
||||||
withCredentials: true,
|
|
||||||
username: 'user',
|
|
||||||
password: 'password'
|
|
||||||
})
|
|
||||||
],
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// with factory building a custom configuration
|
|
||||||
import { ApplicationConfig } from '@angular/core';
|
|
||||||
import { provideHttpClient } from '@angular/common/http';
|
|
||||||
import { provideApi, Configuration } from '';
|
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
|
||||||
providers: [
|
|
||||||
// ...
|
|
||||||
provideHttpClient(),
|
|
||||||
{
|
|
||||||
provide: Configuration,
|
|
||||||
useFactory: (authService: AuthService) => new Configuration({
|
|
||||||
basePath: 'http://localhost:9999',
|
|
||||||
withCredentials: true,
|
|
||||||
username: authService.getUsername(),
|
|
||||||
password: authService.getPassword(),
|
|
||||||
}),
|
|
||||||
deps: [AuthService],
|
|
||||||
multi: false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
### Using multiple OpenAPI files / APIs
|
|
||||||
|
|
||||||
In order to use multiple APIs generated from different OpenAPI files,
|
|
||||||
you can create an alias name when importing the modules
|
|
||||||
in order to avoid naming conflicts:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import { provideApi as provideUserApi } from 'my-user-api-path';
|
|
||||||
import { provideApi as provideAdminApi } from 'my-admin-api-path';
|
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
|
||||||
import { environment } from '../environments/environment';
|
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
|
||||||
providers: [
|
|
||||||
// ...
|
|
||||||
provideHttpClient(),
|
|
||||||
provideUserApi(environment.basePath),
|
|
||||||
provideAdminApi(environment.basePath),
|
|
||||||
],
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
### Customizing path parameter encoding
|
|
||||||
|
|
||||||
Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple'
|
|
||||||
and Dates for format 'date-time' are encoded correctly.
|
|
||||||
|
|
||||||
Other styles (e.g. "matrix") are not that easy to encode
|
|
||||||
and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]).
|
|
||||||
|
|
||||||
To implement your own parameter encoding (or call another library),
|
|
||||||
pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object
|
|
||||||
(see [General Usage](#general-usage) above).
|
|
||||||
|
|
||||||
Example value for use in your Configuration-Provider:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
new Configuration({
|
|
||||||
encodeParam: (param: Param) => myFancyParamEncoder(param),
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations
|
|
||||||
[style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values
|
|
||||||
[@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
|
||||||
import { CustomHttpParameterCodec } from './encoder';
|
|
||||||
import { Configuration } from './configuration';
|
|
||||||
import { OpenApiHttpParams, QueryParamStyle, concatHttpParamsObject} from './query.params';
|
|
||||||
|
|
||||||
export class BaseService {
|
|
||||||
protected basePath = 'http://localhost:8080';
|
|
||||||
public defaultHeaders = new HttpHeaders();
|
|
||||||
public configuration: Configuration;
|
|
||||||
public encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
constructor(basePath?: string|string[], configuration?: Configuration) {
|
|
||||||
this.configuration = configuration || new Configuration();
|
|
||||||
if (typeof this.configuration.basePath !== 'string') {
|
|
||||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
|
||||||
if (firstBasePath != undefined) {
|
|
||||||
basePath = firstBasePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof basePath !== 'string') {
|
|
||||||
basePath = this.basePath;
|
|
||||||
}
|
|
||||||
this.configuration.basePath = basePath;
|
|
||||||
}
|
|
||||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected canConsumeForm(consumes: string[]): boolean {
|
|
||||||
return consumes.indexOf('multipart/form-data') !== -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected addToHttpParams(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined, paramStyle: QueryParamStyle, explode: boolean): OpenApiHttpParams {
|
|
||||||
if (value === null || value === undefined) {
|
|
||||||
return httpParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (paramStyle === QueryParamStyle.DeepObject) {
|
|
||||||
if (typeof value !== 'object') {
|
|
||||||
throw Error(`An object must be provided for key ${key} as it is a deep object`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Object.keys(value as Record<string, any>).reduce(
|
|
||||||
(hp, k) => hp.append(`${key}[${k}]`, value[k]),
|
|
||||||
httpParams,
|
|
||||||
);
|
|
||||||
} else if (paramStyle === QueryParamStyle.Json) {
|
|
||||||
return httpParams.append(key, JSON.stringify(value));
|
|
||||||
} else {
|
|
||||||
// Form-style, SpaceDelimited or PipeDelimited
|
|
||||||
|
|
||||||
if (Object(value) !== value) {
|
|
||||||
// If it is a primitive type, add its string representation
|
|
||||||
return httpParams.append(key, value.toString());
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
return httpParams.append(key, value.toISOString());
|
|
||||||
} else if (Array.isArray(value) || value instanceof Set) {
|
|
||||||
// Otherwise, if it's an array or set, add each element.
|
|
||||||
const array = Array.isArray(value) ? value : Array.from(value);
|
|
||||||
if (paramStyle === QueryParamStyle.Form) {
|
|
||||||
return httpParams.set(key, array, {explode: explode, delimiter: ','});
|
|
||||||
} else if (paramStyle === QueryParamStyle.SpaceDelimited) {
|
|
||||||
return httpParams.set(key, array, {explode: explode, delimiter: ' '});
|
|
||||||
} else {
|
|
||||||
// PipeDelimited
|
|
||||||
return httpParams.set(key, array, {explode: explode, delimiter: '|'});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Otherwise, if it's an object, add each field.
|
|
||||||
if (paramStyle === QueryParamStyle.Form) {
|
|
||||||
if (explode) {
|
|
||||||
Object.keys(value).forEach(k => {
|
|
||||||
httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode);
|
|
||||||
});
|
|
||||||
return httpParams;
|
|
||||||
} else {
|
|
||||||
return concatHttpParamsObject(httpParams, key, value, ',');
|
|
||||||
}
|
|
||||||
} else if (paramStyle === QueryParamStyle.SpaceDelimited) {
|
|
||||||
return concatHttpParamsObject(httpParams, key, value, ' ');
|
|
||||||
} else {
|
|
||||||
// PipeDelimited
|
|
||||||
return concatHttpParamsObject(httpParams, key, value, '|');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
|
|
||||||
import { Configuration } from './configuration';
|
|
||||||
import { HttpClient } from '@angular/common/http';
|
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [],
|
|
||||||
declarations: [],
|
|
||||||
exports: [],
|
|
||||||
providers: []
|
|
||||||
})
|
|
||||||
export class ApiModule {
|
|
||||||
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders<ApiModule> {
|
|
||||||
return {
|
|
||||||
ngModule: ApiModule,
|
|
||||||
providers: [ { provide: Configuration, useFactory: configurationFactory } ]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor( @Optional() @SkipSelf() parentModule: ApiModule,
|
|
||||||
@Optional() http: HttpClient) {
|
|
||||||
if (parentModule) {
|
|
||||||
throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
|
|
||||||
}
|
|
||||||
if (!http) {
|
|
||||||
throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
|
|
||||||
'See also https://github.com/angular/angular/issues/20575');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
export * from './clientController.service';
|
|
||||||
import { ClientControllerService } from './clientController.service';
|
|
||||||
export * from './healthController.service';
|
|
||||||
import { HealthControllerService } from './healthController.service';
|
|
||||||
export * from './playerController.service';
|
|
||||||
import { PlayerControllerService } from './playerController.service';
|
|
||||||
export * from './sessionController.service';
|
|
||||||
import { SessionControllerService } from './sessionController.service';
|
|
||||||
export * from './userController.service';
|
|
||||||
import { UserControllerService } from './userController.service';
|
|
||||||
export * from './youtubeController.service';
|
|
||||||
import { YoutubeControllerService } from './youtubeController.service';
|
|
||||||
export const APIS = [ClientControllerService, HealthControllerService, PlayerControllerService, SessionControllerService, UserControllerService, YoutubeControllerService];
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
|
||||||
import { HttpClient, HttpHeaders, HttpParams,
|
|
||||||
HttpResponse, HttpEvent, HttpContext
|
|
||||||
} from '@angular/common/http';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { OpenApiHttpParams, QueryParamStyle } from '../query.params';
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import { Client } from '../model/client';
|
|
||||||
// @ts-ignore
|
|
||||||
import { ClientRegistrationRequestDto } from '../model/clientRegistrationRequestDto';
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
|
||||||
import { Configuration } from '../configuration';
|
|
||||||
import { BaseService } from '../api.base.service';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class ClientControllerService extends BaseService {
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
|
||||||
super(basePath, configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @endpoint post /api/client/register
|
|
||||||
* @param clientRegistrationRequestDto
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
* @param options additional options
|
|
||||||
*/
|
|
||||||
public registerClient(clientRegistrationRequestDto: ClientRegistrationRequestDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<Client>;
|
|
||||||
public registerClient(clientRegistrationRequestDto: ClientRegistrationRequestDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Client>>;
|
|
||||||
public registerClient(clientRegistrationRequestDto: ClientRegistrationRequestDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Client>>;
|
|
||||||
public registerClient(clientRegistrationRequestDto: ClientRegistrationRequestDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (clientRegistrationRequestDto === null || clientRegistrationRequestDto === undefined) {
|
|
||||||
throw new Error('Required parameter clientRegistrationRequestDto was null or undefined when calling registerClient.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
||||||
'*/*'
|
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
|
||||||
const consumes: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
|
||||||
if (httpContentTypeSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/client/register`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<Client>('post', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
body: clientRegistrationRequestDto,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
|
||||||
import { HttpClient, HttpHeaders, HttpParams,
|
|
||||||
HttpResponse, HttpEvent, HttpContext
|
|
||||||
} from '@angular/common/http';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { OpenApiHttpParams, QueryParamStyle } from '../query.params';
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
|
||||||
import { Configuration } from '../configuration';
|
|
||||||
import { BaseService } from '../api.base.service';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class HealthControllerService extends BaseService {
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
|
||||||
super(basePath, configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @endpoint get /health/ping
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
* @param options additional options
|
|
||||||
*/
|
|
||||||
public ping(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<string>;
|
|
||||||
public ping(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<string>>;
|
|
||||||
public ping(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<string>>;
|
|
||||||
public ping(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
||||||
'*/*'
|
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/health/ping`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<string>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
|
||||||
import { HttpClient, HttpHeaders, HttpParams,
|
|
||||||
HttpResponse, HttpEvent, HttpContext
|
|
||||||
} from '@angular/common/http';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { OpenApiHttpParams, QueryParamStyle } from '../query.params';
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
|
||||||
import { Configuration } from '../configuration';
|
|
||||||
import { BaseService } from '../api.base.service';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class PlayerControllerService extends BaseService {
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
|
||||||
super(basePath, configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @endpoint post /api/player/play/{id}
|
|
||||||
* @param id
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
* @param options additional options
|
|
||||||
*/
|
|
||||||
public play(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<string>;
|
|
||||||
public play(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<string>>;
|
|
||||||
public play(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<string>>;
|
|
||||||
public play(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (id === null || id === undefined) {
|
|
||||||
throw new Error('Required parameter id was null or undefined when calling play.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
||||||
'*/*'
|
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/player/play/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<string>('post', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,256 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
|
||||||
import { HttpClient, HttpHeaders, HttpParams,
|
|
||||||
HttpResponse, HttpEvent, HttpContext
|
|
||||||
} from '@angular/common/http';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { OpenApiHttpParams, QueryParamStyle } from '../query.params';
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import { Session } from '../model/session';
|
|
||||||
// @ts-ignore
|
|
||||||
import { User } from '../model/user';
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
|
||||||
import { Configuration } from '../configuration';
|
|
||||||
import { BaseService } from '../api.base.service';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class SessionControllerService extends BaseService {
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
|
||||||
super(basePath, configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @endpoint post /session/music/add/{musicId}
|
|
||||||
* @param authorization
|
|
||||||
* @param musicId
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
* @param options additional options
|
|
||||||
*/
|
|
||||||
public addMusic(authorization: string, musicId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<User>;
|
|
||||||
public addMusic(authorization: string, musicId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<User>>;
|
|
||||||
public addMusic(authorization: string, musicId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<User>>;
|
|
||||||
public addMusic(authorization: string, musicId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (authorization === null || authorization === undefined) {
|
|
||||||
throw new Error('Required parameter authorization was null or undefined when calling addMusic.');
|
|
||||||
}
|
|
||||||
if (musicId === null || musicId === undefined) {
|
|
||||||
throw new Error('Required parameter musicId was null or undefined when calling addMusic.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
if (authorization !== undefined && authorization !== null) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Authorization', String(authorization));
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
||||||
'*/*'
|
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/session/music/add/${this.configuration.encodeParam({name: "musicId", value: musicId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<User>('post', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @endpoint get /session
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
* @param options additional options
|
|
||||||
*/
|
|
||||||
public getSession(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Session>;
|
|
||||||
public getSession(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Session>>;
|
|
||||||
public getSession(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Session>>;
|
|
||||||
public getSession(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
||||||
'application/json'
|
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log(responseType_)
|
|
||||||
|
|
||||||
let localVarPath = `/session`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<Session>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @endpoint get /session/testing/next/user
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
* @param options additional options
|
|
||||||
*/
|
|
||||||
public nextUser(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<Session>;
|
|
||||||
public nextUser(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Session>>;
|
|
||||||
public nextUser(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Session>>;
|
|
||||||
public nextUser(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
||||||
'*/*'
|
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/session/testing/next/user`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<Session>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @endpoint get /session/testing/play/next
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
* @param options additional options
|
|
||||||
*/
|
|
||||||
public playNext(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<Session>;
|
|
||||||
public playNext(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Session>>;
|
|
||||||
public playNext(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Session>>;
|
|
||||||
public playNext(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
||||||
'*/*'
|
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/session/testing/play/next`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<Session>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
|
||||||
import { HttpClient, HttpHeaders, HttpParams,
|
|
||||||
HttpResponse, HttpEvent, HttpContext
|
|
||||||
} from '@angular/common/http';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { OpenApiHttpParams, QueryParamStyle } from '../query.params';
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import { CreateUserRequest } from '../model/createUserRequest';
|
|
||||||
// @ts-ignore
|
|
||||||
import { User } from '../model/user';
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
|
||||||
import { Configuration } from '../configuration';
|
|
||||||
import { BaseService } from '../api.base.service';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class UserControllerService extends BaseService {
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
|
||||||
super(basePath, configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @endpoint post /api/user
|
|
||||||
* @param createUserRequest
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
* @param options additional options
|
|
||||||
*/
|
|
||||||
public createUser(createUserRequest: CreateUserRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<Array<User>>;
|
|
||||||
public createUser(createUserRequest: CreateUserRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<User>>>;
|
|
||||||
public createUser(createUserRequest: CreateUserRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<User>>>;
|
|
||||||
public createUser(createUserRequest: CreateUserRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (createUserRequest === null || createUserRequest === undefined) {
|
|
||||||
throw new Error('Required parameter createUserRequest was null or undefined when calling createUser.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
||||||
'*/*'
|
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
|
||||||
const consumes: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
|
||||||
if (httpContentTypeSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/user`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<Array<User>>('post', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
body: createUserRequest,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
|
||||||
import { HttpClient, HttpHeaders, HttpParams,
|
|
||||||
HttpResponse, HttpEvent, HttpContext
|
|
||||||
} from '@angular/common/http';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { OpenApiHttpParams, QueryParamStyle } from '../query.params';
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import { MusicRecord } from '../model/musicRecord';
|
|
||||||
// @ts-ignore
|
|
||||||
import { QueryDto } from '../model/queryDto';
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
|
||||||
import { Configuration } from '../configuration';
|
|
||||||
import { BaseService } from '../api.base.service';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class YoutubeControllerService extends BaseService {
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
|
||||||
super(basePath, configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @endpoint post /api/youtube/query
|
|
||||||
* @param queryDto
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
* @param options additional options
|
|
||||||
*/
|
|
||||||
public createProduct(queryDto: QueryDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<Array<MusicRecord>>;
|
|
||||||
public createProduct(queryDto: QueryDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<MusicRecord>>>;
|
|
||||||
public createProduct(queryDto: QueryDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<MusicRecord>>>;
|
|
||||||
public createProduct(queryDto: QueryDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: '*/*', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (queryDto === null || queryDto === undefined) {
|
|
||||||
throw new Error('Required parameter queryDto was null or undefined when calling createProduct.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
||||||
'*/*'
|
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
|
||||||
const consumes: string[] = [
|
|
||||||
'application/json'
|
|
||||||
];
|
|
||||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
|
||||||
if (httpContentTypeSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/youtube/query`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<Array<MusicRecord>>('post', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
body: queryDto,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,185 +0,0 @@
|
|||||||
import { HttpHeaders, HttpParameterCodec } from '@angular/common/http';
|
|
||||||
import { Param } from './param';
|
|
||||||
import { OpenApiHttpParams } from './query.params';
|
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
|
||||||
/**
|
|
||||||
* @deprecated Since 5.0. Use credentials instead
|
|
||||||
*/
|
|
||||||
apiKeys?: {[ key: string ]: string};
|
|
||||||
username?: string;
|
|
||||||
password?: string;
|
|
||||||
/**
|
|
||||||
* @deprecated Since 5.0. Use credentials instead
|
|
||||||
*/
|
|
||||||
accessToken?: string | (() => string);
|
|
||||||
basePath?: string;
|
|
||||||
withCredentials?: boolean;
|
|
||||||
/**
|
|
||||||
* Takes care of encoding query- and form-parameters.
|
|
||||||
*/
|
|
||||||
encoder?: HttpParameterCodec;
|
|
||||||
/**
|
|
||||||
* Override the default method for encoding path parameters in various
|
|
||||||
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
|
|
||||||
* <p>
|
|
||||||
* See {@link README.md} for more details
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
encodeParam?: (param: Param) => string;
|
|
||||||
/**
|
|
||||||
* The keys are the names in the securitySchemes section of the OpenAPI
|
|
||||||
* document. They should map to the value used for authentication
|
|
||||||
* minus any standard prefixes such as 'Basic' or 'Bearer'.
|
|
||||||
*/
|
|
||||||
credentials?: {[ key: string ]: string | (() => string | undefined)};
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Configuration {
|
|
||||||
/**
|
|
||||||
* @deprecated Since 5.0. Use credentials instead
|
|
||||||
*/
|
|
||||||
apiKeys?: {[ key: string ]: string};
|
|
||||||
username?: string;
|
|
||||||
password?: string;
|
|
||||||
/**
|
|
||||||
* @deprecated Since 5.0. Use credentials instead
|
|
||||||
*/
|
|
||||||
accessToken?: string | (() => string);
|
|
||||||
basePath?: string;
|
|
||||||
withCredentials?: boolean;
|
|
||||||
/**
|
|
||||||
* Takes care of encoding query- and form-parameters.
|
|
||||||
*/
|
|
||||||
encoder?: HttpParameterCodec;
|
|
||||||
/**
|
|
||||||
* Encoding of various path parameter
|
|
||||||
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
|
|
||||||
* <p>
|
|
||||||
* See {@link README.md} for more details
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
encodeParam: (param: Param) => string;
|
|
||||||
/**
|
|
||||||
* The keys are the names in the securitySchemes section of the OpenAPI
|
|
||||||
* document. They should map to the value used for authentication
|
|
||||||
* minus any standard prefixes such as 'Basic' or 'Bearer'.
|
|
||||||
*/
|
|
||||||
credentials: {[ key: string ]: string | (() => string | undefined)};
|
|
||||||
|
|
||||||
constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) {
|
|
||||||
if (apiKeys) {
|
|
||||||
this.apiKeys = apiKeys;
|
|
||||||
}
|
|
||||||
if (username !== undefined) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
if (password !== undefined) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
if (accessToken !== undefined) {
|
|
||||||
this.accessToken = accessToken;
|
|
||||||
}
|
|
||||||
if (basePath !== undefined) {
|
|
||||||
this.basePath = basePath;
|
|
||||||
}
|
|
||||||
if (withCredentials !== undefined) {
|
|
||||||
this.withCredentials = withCredentials;
|
|
||||||
}
|
|
||||||
if (encoder) {
|
|
||||||
this.encoder = encoder;
|
|
||||||
}
|
|
||||||
this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param));
|
|
||||||
this.credentials = credentials ?? {};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Select the correct content-type to use for a request.
|
|
||||||
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
|
|
||||||
* If no content type is found return the first found type if the contentTypes is not empty
|
|
||||||
* @param contentTypes - the array of content types that are available for selection
|
|
||||||
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
|
|
||||||
*/
|
|
||||||
public selectHeaderContentType (contentTypes: string[]): string | undefined {
|
|
||||||
if (contentTypes.length === 0) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const type = contentTypes.find((x: string) => this.isJsonMime(x));
|
|
||||||
if (type === undefined) {
|
|
||||||
return contentTypes[0];
|
|
||||||
}
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Select the correct accept content-type to use for a request.
|
|
||||||
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
|
|
||||||
* If no content type is found return the first found type if the contentTypes is not empty
|
|
||||||
* @param accepts - the array of content types that are available for selection.
|
|
||||||
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
|
|
||||||
*/
|
|
||||||
public selectHeaderAccept(accepts: string[]): string | undefined {
|
|
||||||
if (accepts.length === 0) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const type = accepts.find((x: string) => this.isJsonMime(x));
|
|
||||||
if (type === undefined) {
|
|
||||||
return accepts[0];
|
|
||||||
}
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the given MIME is a JSON MIME.
|
|
||||||
* JSON MIME examples:
|
|
||||||
* application/json
|
|
||||||
* application/json; charset=UTF8
|
|
||||||
* APPLICATION/JSON
|
|
||||||
* application/vnd.company+json
|
|
||||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
||||||
* @return True if the given MIME is JSON, false otherwise.
|
|
||||||
*/
|
|
||||||
public isJsonMime(mime: string): boolean {
|
|
||||||
const jsonMime: RegExp = /^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$/i;
|
|
||||||
return mime !== null && jsonMime.test(mime);
|
|
||||||
}
|
|
||||||
|
|
||||||
public lookupCredential(key: string): string | undefined {
|
|
||||||
const value = this.credentials[key];
|
|
||||||
return typeof value === 'function'
|
|
||||||
? value()
|
|
||||||
: value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
|
||||||
const value = this.lookupCredential(credentialKey);
|
|
||||||
return value
|
|
||||||
? headers.set(headerName, (prefix ?? '') + value)
|
|
||||||
: headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams {
|
|
||||||
const value = this.lookupCredential(credentialKey);
|
|
||||||
return value
|
|
||||||
? query.set(paramName, value)
|
|
||||||
: query;
|
|
||||||
}
|
|
||||||
|
|
||||||
private defaultEncodeParam(param: Param): string {
|
|
||||||
// This implementation exists as fallback for missing configuration
|
|
||||||
// and for backwards compatibility to older typescript-angular generator versions.
|
|
||||||
// It only works for the 'simple' parameter style.
|
|
||||||
// Date-handling only works for the 'date-time' format.
|
|
||||||
// All other styles and Date-formats are probably handled incorrectly.
|
|
||||||
//
|
|
||||||
// But: if that's all you need (i.e.: the most common use-case): no need for customization!
|
|
||||||
|
|
||||||
const value = param.dataFormat === 'date-time' && param.value instanceof Date
|
|
||||||
? (param.value as Date).toISOString()
|
|
||||||
: param.value;
|
|
||||||
|
|
||||||
return encodeURIComponent(String(value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
import { HttpParameterCodec } from '@angular/common/http';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Custom HttpParameterCodec
|
|
||||||
* Workaround for https://github.com/angular/angular/issues/18261
|
|
||||||
*/
|
|
||||||
export class CustomHttpParameterCodec implements HttpParameterCodec {
|
|
||||||
encodeKey(k: string): string {
|
|
||||||
return encodeURIComponent(k);
|
|
||||||
}
|
|
||||||
encodeValue(v: string): string {
|
|
||||||
return encodeURIComponent(v);
|
|
||||||
}
|
|
||||||
decodeKey(k: string): string {
|
|
||||||
return decodeURIComponent(k);
|
|
||||||
}
|
|
||||||
decodeValue(v: string): string {
|
|
||||||
return decodeURIComponent(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class IdentityHttpParameterCodec implements HttpParameterCodec {
|
|
||||||
encodeKey(k: string): string {
|
|
||||||
return k;
|
|
||||||
}
|
|
||||||
encodeValue(v: string): string {
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
decodeKey(k: string): string {
|
|
||||||
return k;
|
|
||||||
}
|
|
||||||
decodeValue(v: string): string {
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
|
||||||
#
|
|
||||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
|
||||||
|
|
||||||
git_user_id=$1
|
|
||||||
git_repo_id=$2
|
|
||||||
release_note=$3
|
|
||||||
git_host=$4
|
|
||||||
|
|
||||||
if [ "$git_host" = "" ]; then
|
|
||||||
git_host="github.com"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
|
||||||
git_user_id="GIT_USER_ID"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$git_repo_id" = "" ]; then
|
|
||||||
git_repo_id="GIT_REPO_ID"
|
|
||||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$release_note" = "" ]; then
|
|
||||||
release_note="Minor update"
|
|
||||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Initialize the local directory as a Git repository
|
|
||||||
git init
|
|
||||||
|
|
||||||
# Adds the files in the local repository and stages them for commit.
|
|
||||||
git add .
|
|
||||||
|
|
||||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
|
||||||
git commit -m "$release_note"
|
|
||||||
|
|
||||||
# Sets the new remote
|
|
||||||
git_remote=$(git remote)
|
|
||||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
|
||||||
|
|
||||||
if [ "$GIT_TOKEN" = "" ]; then
|
|
||||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
|
||||||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
|
||||||
else
|
|
||||||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
git pull origin master
|
|
||||||
|
|
||||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
|
||||||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
|
||||||
git push origin master 2>&1 | grep -v 'To https'
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
export * from './api/api';
|
|
||||||
export * from './model/models';
|
|
||||||
export * from './variables';
|
|
||||||
export * from './configuration';
|
|
||||||
export * from './api.module';
|
|
||||||
export * from './provide-api';
|
|
||||||
export * from './param';
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
export interface Album {
|
|
||||||
id?: string;
|
|
||||||
name?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
export interface Artist {
|
|
||||||
id?: string;
|
|
||||||
name?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
export interface Client {
|
|
||||||
id?: string;
|
|
||||||
host?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
export interface ClientRegistrationRequestDto {
|
|
||||||
host?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
export interface CreateUserRequest {
|
|
||||||
userId?: string;
|
|
||||||
nickName?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
export * from './album';
|
|
||||||
export * from './artist';
|
|
||||||
export * from './client';
|
|
||||||
export * from './clientRegistrationRequestDto';
|
|
||||||
export * from './createUserRequest';
|
|
||||||
export * from './musicRecord';
|
|
||||||
export * from './queryDto';
|
|
||||||
export * from './session';
|
|
||||||
export * from './sessionQueueElement';
|
|
||||||
export * from './thumbnails';
|
|
||||||
export * from './user';
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
import { Artist } from './artist';
|
|
||||||
import { Album } from './album';
|
|
||||||
import { Thumbnails } from './thumbnails';
|
|
||||||
|
|
||||||
|
|
||||||
export interface MusicRecord {
|
|
||||||
category?: string;
|
|
||||||
resultType?: string;
|
|
||||||
title?: string;
|
|
||||||
videoId?: string;
|
|
||||||
duration_seconds?: string;
|
|
||||||
duration?: string;
|
|
||||||
year?: string;
|
|
||||||
views?: string;
|
|
||||||
album?: Album;
|
|
||||||
artists?: Array<Artist>;
|
|
||||||
thumbnails?: Array<Thumbnails>;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
export interface QueryDto {
|
|
||||||
queryString?: string;
|
|
||||||
filter?: QueryDto.FilterEnum;
|
|
||||||
limit?: number;
|
|
||||||
}
|
|
||||||
export namespace QueryDto {
|
|
||||||
export const FilterEnum = {
|
|
||||||
Albums: 'ALBUMS',
|
|
||||||
Artists: 'ARTISTS',
|
|
||||||
Playlists: 'PLAYLISTS',
|
|
||||||
CommunityPlaylists: 'COMMUNITY_PLAYLISTS',
|
|
||||||
FeaturedPlalists: 'FEATURED_PLALISTS',
|
|
||||||
Videos: 'VIDEOS',
|
|
||||||
Profiles: 'PROFILES',
|
|
||||||
Podcasts: 'PODCASTS',
|
|
||||||
Episodes: 'EPISODES',
|
|
||||||
Songs: 'SONGS',
|
|
||||||
None: 'NONE'
|
|
||||||
} as const;
|
|
||||||
export type FilterEnum = typeof FilterEnum[keyof typeof FilterEnum];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
import { MusicRecord } from './musicRecord';
|
|
||||||
import { User } from './user';
|
|
||||||
import { SessionQueueElement } from './sessionQueueElement';
|
|
||||||
|
|
||||||
|
|
||||||
export interface Session {
|
|
||||||
sessionId?: string;
|
|
||||||
currentUserIndex?: number;
|
|
||||||
currentMusicRecord?: MusicRecord;
|
|
||||||
sessionQueue?: Array<SessionQueueElement>;
|
|
||||||
users?: Array<User>;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
import { MusicRecord } from './musicRecord';
|
|
||||||
|
|
||||||
|
|
||||||
export interface SessionQueueElement {
|
|
||||||
userName?: string;
|
|
||||||
musicRecord?: MusicRecord;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
export interface Thumbnails {
|
|
||||||
url?: string;
|
|
||||||
width?: number;
|
|
||||||
height?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
/**
|
|
||||||
* OpenAPI definition
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
import { MusicRecord } from './musicRecord';
|
|
||||||
|
|
||||||
|
|
||||||
export interface User {
|
|
||||||
userId?: string;
|
|
||||||
nickName?: string;
|
|
||||||
popped?: Array<MusicRecord>;
|
|
||||||
musicQueue?: Array<MusicRecord>;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
/**
|
|
||||||
* Standard parameter styles defined by OpenAPI spec
|
|
||||||
*/
|
|
||||||
export type StandardParamStyle =
|
|
||||||
| 'matrix'
|
|
||||||
| 'label'
|
|
||||||
| 'form'
|
|
||||||
| 'simple'
|
|
||||||
| 'spaceDelimited'
|
|
||||||
| 'pipeDelimited'
|
|
||||||
| 'deepObject'
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The OpenAPI standard {@link StandardParamStyle}s may be extended by custom styles by the user.
|
|
||||||
*/
|
|
||||||
export type ParamStyle = StandardParamStyle | string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Standard parameter locations defined by OpenAPI spec
|
|
||||||
*/
|
|
||||||
export type ParamLocation = 'query' | 'header' | 'path' | 'cookie';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Standard types as defined in <a href="https://swagger.io/specification/#data-types">OpenAPI Specification: Data Types</a>
|
|
||||||
*/
|
|
||||||
export type StandardDataType =
|
|
||||||
| "integer"
|
|
||||||
| "number"
|
|
||||||
| "boolean"
|
|
||||||
| "string"
|
|
||||||
| "object"
|
|
||||||
| "array"
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Standard {@link DataType}s plus your own types/classes.
|
|
||||||
*/
|
|
||||||
export type DataType = StandardDataType | string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Standard formats as defined in <a href="https://swagger.io/specification/#data-types">OpenAPI Specification: Data Types</a>
|
|
||||||
*/
|
|
||||||
export type StandardDataFormat =
|
|
||||||
| "int32"
|
|
||||||
| "int64"
|
|
||||||
| "float"
|
|
||||||
| "double"
|
|
||||||
| "byte"
|
|
||||||
| "binary"
|
|
||||||
| "date"
|
|
||||||
| "date-time"
|
|
||||||
| "password"
|
|
||||||
;
|
|
||||||
|
|
||||||
export type DataFormat = StandardDataFormat | string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The parameter to encode.
|
|
||||||
*/
|
|
||||||
export interface Param {
|
|
||||||
name: string;
|
|
||||||
value: unknown;
|
|
||||||
in: ParamLocation;
|
|
||||||
style: ParamStyle,
|
|
||||||
explode: boolean;
|
|
||||||
dataType: DataType;
|
|
||||||
dataFormat: DataFormat | undefined;
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import { EnvironmentProviders, makeEnvironmentProviders } from "@angular/core";
|
|
||||||
import { Configuration, ConfigurationParameters } from './configuration';
|
|
||||||
import { BASE_PATH } from './variables';
|
|
||||||
|
|
||||||
// Returns the service class providers, to be used in the [ApplicationConfig](https://angular.dev/api/core/ApplicationConfig).
|
|
||||||
export function provideApi(configOrBasePath: string | ConfigurationParameters): EnvironmentProviders {
|
|
||||||
return makeEnvironmentProviders([
|
|
||||||
typeof configOrBasePath === "string"
|
|
||||||
? { provide: BASE_PATH, useValue: configOrBasePath }
|
|
||||||
: {
|
|
||||||
provide: Configuration,
|
|
||||||
useValue: new Configuration({ ...configOrBasePath }),
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
@@ -1,160 +0,0 @@
|
|||||||
import { HttpParams, HttpParameterCodec } from '@angular/common/http';
|
|
||||||
import { CustomHttpParameterCodec, IdentityHttpParameterCodec } from './encoder';
|
|
||||||
|
|
||||||
export enum QueryParamStyle {
|
|
||||||
Json,
|
|
||||||
Form,
|
|
||||||
DeepObject,
|
|
||||||
SpaceDelimited,
|
|
||||||
PipeDelimited,
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Delimiter = "," | " " | "|" | "\t";
|
|
||||||
|
|
||||||
export interface ParamOptions {
|
|
||||||
/** When true, serialized as multiple repeated key=value pairs. When false, serialized as a single key with joined values using `delimiter`. */
|
|
||||||
explode?: boolean;
|
|
||||||
/** Delimiter used when explode=false. The delimiter itself is inserted unencoded between encoded values. */
|
|
||||||
delimiter?: Delimiter;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ParamEntry {
|
|
||||||
values: string[];
|
|
||||||
options: Required<ParamOptions>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class OpenApiHttpParams {
|
|
||||||
private params: Map<string, ParamEntry> = new Map();
|
|
||||||
private defaults: Required<ParamOptions>;
|
|
||||||
private encoder: HttpParameterCodec;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param encoder Parameter serializer
|
|
||||||
* @param defaults Global defaults used when a specific parameter has no explicit options.
|
|
||||||
* By OpenAPI default, explode is true for query params with style=form.
|
|
||||||
*/
|
|
||||||
constructor(encoder?: HttpParameterCodec, defaults?: { explode?: boolean; delimiter?: Delimiter }) {
|
|
||||||
this.encoder = encoder || new CustomHttpParameterCodec();
|
|
||||||
this.defaults = {
|
|
||||||
explode: defaults?.explode ?? true,
|
|
||||||
delimiter: defaults?.delimiter ?? ",",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private resolveOptions(local?: ParamOptions): Required<ParamOptions> {
|
|
||||||
return {
|
|
||||||
explode: local?.explode ?? this.defaults.explode,
|
|
||||||
delimiter: local?.delimiter ?? this.defaults.delimiter,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Replace the parameter's values and (optionally) its options.
|
|
||||||
* Options are stored per-parameter (not global).
|
|
||||||
*/
|
|
||||||
set(key: string, values: string[] | string, options?: ParamOptions): this {
|
|
||||||
const arr = Array.isArray(values) ? values.slice() : [values];
|
|
||||||
const opts = this.resolveOptions(options);
|
|
||||||
this.params.set(key, {values: arr, options: opts});
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Append a single value to the parameter. If the parameter didn't exist it will be created
|
|
||||||
* and use resolved options (global defaults merged with any provided options).
|
|
||||||
*/
|
|
||||||
append(key: string, value: string, options?: ParamOptions): this {
|
|
||||||
const entry = this.params.get(key);
|
|
||||||
if (entry) {
|
|
||||||
// If new options provided, override the stored options for subsequent serialization
|
|
||||||
if (options) {
|
|
||||||
entry.options = this.resolveOptions({...entry.options, ...options});
|
|
||||||
}
|
|
||||||
entry.values.push(value);
|
|
||||||
} else {
|
|
||||||
this.set(key, [value], options);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serialize to a query string according to per-parameter OpenAPI options.
|
|
||||||
* - If explode=true for that parameter → repeated key=value pairs (each value encoded).
|
|
||||||
* - If explode=false for that parameter → single key=value where values are individually encoded
|
|
||||||
* and joined using the configured delimiter. The delimiter character is inserted AS-IS
|
|
||||||
* (not percent-encoded).
|
|
||||||
*/
|
|
||||||
toString(): string {
|
|
||||||
const records = this.toRecord();
|
|
||||||
const parts: string[] = [];
|
|
||||||
|
|
||||||
for (const key in records) {
|
|
||||||
parts.push(`${key}=${records[key]}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return parts.join("&");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return parameters as a plain record.
|
|
||||||
* - If a parameter has exactly one value, returns that value directly.
|
|
||||||
* - If a parameter has multiple values, returns a readonly array of values.
|
|
||||||
*/
|
|
||||||
toRecord(): Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>> {
|
|
||||||
const parts: Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>> = {};
|
|
||||||
|
|
||||||
for (const [key, entry] of this.params.entries()) {
|
|
||||||
const encodedKey = this.encoder.encodeKey(key);
|
|
||||||
|
|
||||||
if (entry.options.explode) {
|
|
||||||
parts[encodedKey] = entry.values.map((v) => this.encoder.encodeValue(v));
|
|
||||||
} else {
|
|
||||||
const encodedValues = entry.values.map((v) => this.encoder.encodeValue(v));
|
|
||||||
|
|
||||||
// join with the delimiter *unencoded*
|
|
||||||
parts[encodedKey] = encodedValues.join(entry.options.delimiter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return parts;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an Angular's HttpParams with an identity parameter codec as the parameters are already encoded.
|
|
||||||
*/
|
|
||||||
toHttpParams(): HttpParams {
|
|
||||||
const records = this.toRecord();
|
|
||||||
|
|
||||||
let httpParams = new HttpParams({encoder: new IdentityHttpParameterCodec()});
|
|
||||||
|
|
||||||
return httpParams.appendAll(records);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function concatHttpParamsObject(httpParams: OpenApiHttpParams, key: string, item: {
|
|
||||||
[index: string]: any
|
|
||||||
}, delimiter: Delimiter): OpenApiHttpParams {
|
|
||||||
let keyAndValues: string[] = [];
|
|
||||||
|
|
||||||
for (const k in item) {
|
|
||||||
keyAndValues.push(k);
|
|
||||||
|
|
||||||
const value = item[k];
|
|
||||||
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
keyAndValues.push(...value.map(convertToString));
|
|
||||||
} else {
|
|
||||||
keyAndValues.push(convertToString(value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return httpParams.set(key, keyAndValues, {explode: false, delimiter: delimiter});
|
|
||||||
}
|
|
||||||
|
|
||||||
function convertToString(value: any): string {
|
|
||||||
if (value instanceof Date) {
|
|
||||||
return value.toISOString();
|
|
||||||
} else {
|
|
||||||
return value.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import { InjectionToken } from '@angular/core';
|
|
||||||
|
|
||||||
export const BASE_PATH = new InjectionToken<string>('basePath');
|
|
||||||
export const COLLECTION_FORMATS = {
|
|
||||||
'csv': ',',
|
|
||||||
'tsv': ' ',
|
|
||||||
'ssv': ' ',
|
|
||||||
'pipes': '|'
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// Generated using typescript-generator version 4.1.1 on 2026-07-24 16:46:55.
|
||||||
|
|
||||||
|
export interface Session {
|
||||||
|
sessionId: string;
|
||||||
|
currentUserIndex: number;
|
||||||
|
currentMusicRecord: MusicRecord;
|
||||||
|
sessionQueue: SessionQueueElement[];
|
||||||
|
users: User[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MusicRecord {
|
||||||
|
category: string;
|
||||||
|
resultType: string;
|
||||||
|
title: string;
|
||||||
|
videoId: string;
|
||||||
|
duration_seconds: string;
|
||||||
|
duration: string;
|
||||||
|
year: string;
|
||||||
|
views: string;
|
||||||
|
album: Album;
|
||||||
|
artists: Artist[];
|
||||||
|
thumbnails: Thumbnails[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SessionQueueElement {
|
||||||
|
userName: string;
|
||||||
|
musicRecord: MusicRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface User {
|
||||||
|
userId: string;
|
||||||
|
nickName: string;
|
||||||
|
popped: MusicRecord[];
|
||||||
|
musicQueue: MusicRecord[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Album {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Artist {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Thumbnails {
|
||||||
|
url: string;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
}
|
||||||
@@ -13,14 +13,14 @@
|
|||||||
/* Optional: constrain image size so it doesn't get too large */
|
/* Optional: constrain image size so it doesn't get too large */
|
||||||
.image-text-container img {
|
.image-text-container img {
|
||||||
width: 150px;
|
width: 150px;
|
||||||
height: auto;
|
height: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.yt-result {
|
.yt-result {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: left;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100%;
|
width: 400px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<div class="yt-result">
|
<div class="yt-result">
|
||||||
<div class="image-text-container">
|
<div class="image-text-container">
|
||||||
<img src="https://yt3.googleusercontent.com/RFK4wHeGqwI3DndbARbRJB21IC0TcmqnrlyjxYK7T-nC8wlIVbfxNaCIFKNvSpchDKmYyVLe1RN36w=w120-h120-l90-rj"
|
<img [src]="thumbnailUrl"
|
||||||
width="60" height="60">
|
width="60" height="60">
|
||||||
|
|
||||||
<div class="image-text-container-description">
|
<div class="image-text-container-description">
|
||||||
<div class="yt-result-title">Abracadabra</div>
|
<div>{{ title }}</div>
|
||||||
<div class="yt-result_metadata">Lady Gaga</div>
|
<div>{{ artist }}</div>
|
||||||
<div class="yt-result_metadata">MAYHEM</div>
|
<div>{{ album }}</div>
|
||||||
<div class="yt-result_metadata">3:44</div>
|
<div>{{ duration }}</div>
|
||||||
<div class="yt-result_metadata">15M</div>
|
<div>{{ views }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,9 +1,65 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, Input, OnChanges, ChangeDetectionStrategy, ChangeDetectorRef, SimpleChanges } from '@angular/core';
|
||||||
|
import { MusicRecord } from '../api';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-youtube-search-result',
|
selector: 'app-youtube-search-result',
|
||||||
imports: [],
|
imports: [],
|
||||||
templateUrl: './youtube-search-result.html',
|
templateUrl: './youtube-search-result.html',
|
||||||
styleUrl: './youtube-search-result.css',
|
styleUrl: './youtube-search-result.css',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class YoutubeSearchResult {}
|
export class YoutubeSearchResult implements OnChanges {
|
||||||
|
@Input() musicRecord: MusicRecord | null = null;
|
||||||
|
|
||||||
|
private _title = 'Video Title';
|
||||||
|
private _artist = 'Artist Name';
|
||||||
|
private _album = 'Album Name';
|
||||||
|
private _duration = '0:00';
|
||||||
|
private _views = '0 views';
|
||||||
|
private _thumbnailUrl =
|
||||||
|
'https://yt3.googleusercontent.com/RFK4wHeGqwI3DndbARbRJB21IC0TcmqnrlyjxYK7T-nC8wlIVbfxNaCIFKNvSpchDKmYyVLe1RN36w=w120-h120-l90-rj';
|
||||||
|
|
||||||
|
constructor(private cdr: ChangeDetectorRef) {}
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
|
if (changes['musicRecord']) {
|
||||||
|
this.updateFromMusicRecord();
|
||||||
|
this.cdr.markForCheck();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private updateFromMusicRecord(): void {
|
||||||
|
if (this.musicRecord) {
|
||||||
|
this._title = this.musicRecord.title || 'Video Title';
|
||||||
|
this._artist = this.musicRecord.artists?.[0]?.name || 'Artist Name';
|
||||||
|
this._album = this.musicRecord.album?.name || 'Album Name';
|
||||||
|
this._duration = this.musicRecord.duration || '0:00';
|
||||||
|
this._views = this.musicRecord.views || '0 views';
|
||||||
|
this._thumbnailUrl = this.musicRecord.thumbnails?.[1]?.url || this._thumbnailUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get title(): string {
|
||||||
|
return this._title;
|
||||||
|
}
|
||||||
|
|
||||||
|
get artist(): string {
|
||||||
|
return this._artist;
|
||||||
|
}
|
||||||
|
|
||||||
|
get album(): string {
|
||||||
|
return this._album;
|
||||||
|
}
|
||||||
|
|
||||||
|
get duration(): string {
|
||||||
|
return this._duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
get views(): string {
|
||||||
|
return this._views;
|
||||||
|
}
|
||||||
|
|
||||||
|
get thumbnailUrl(): string {
|
||||||
|
return this._thumbnailUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
.search-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center; /* center horizontally */
|
||||||
|
align-items: center; /* center vertically */
|
||||||
|
gap: 12px;
|
||||||
|
width: 100%;
|
||||||
|
padding: 16px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make the mat-form-field a reasonable fixed width but responsive on small screens */
|
||||||
|
.search-field {
|
||||||
|
width: 420px;
|
||||||
|
max-width: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ensure the input stretches to the mat-form-field width */
|
||||||
|
.search-field .mat-form-field-wrapper,
|
||||||
|
.search-field .mat-form-field-flex {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Optional: ensure the button aligns nicely */
|
||||||
|
.search-container button {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<div class="search-container">
|
||||||
|
<mat-form-field class="search-field">
|
||||||
|
<mat-label>Search</mat-label>
|
||||||
|
<input matInput [(ngModel)]="searchQuery" placeholder="Enter search query">
|
||||||
|
</mat-form-field>
|
||||||
|
<button mat-raised-button color="primary" (click)="performSearch()">Search</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="search-results">
|
||||||
|
<app-youtube-search-result
|
||||||
|
*ngFor="let record of searchResults()"
|
||||||
|
[musicRecord]="record">
|
||||||
|
</app-youtube-search-result>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { YoutubeSearchTab } from './youtube-search-tab';
|
||||||
|
|
||||||
|
describe('YoutubeSearchTab', () => {
|
||||||
|
let component: YoutubeSearchTab;
|
||||||
|
let fixture: ComponentFixture<YoutubeSearchTab>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [YoutubeSearchTab],
|
||||||
|
}).compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(YoutubeSearchTab);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
await fixture.whenStable();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import {
|
||||||
|
Component,
|
||||||
|
inject,
|
||||||
|
ChangeDetectionStrategy,
|
||||||
|
ChangeDetectorRef,
|
||||||
|
Signal,
|
||||||
|
signal, WritableSignal,
|
||||||
|
} from '@angular/core';
|
||||||
|
import { MusicRecord, QueryDto, YoutubeControllerService } from '../api';
|
||||||
|
import { YoutubeSearchResult } from '../youtube-search-result/youtube-search-result';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-youtube-search-tab',
|
||||||
|
imports: [YoutubeSearchResult, CommonModule, MatFormFieldModule, MatInputModule, MatButtonModule, FormsModule],
|
||||||
|
templateUrl: './youtube-search-tab.html',
|
||||||
|
styleUrl: './youtube-search-tab.css'
|
||||||
|
})
|
||||||
|
export class YoutubeSearchTab {
|
||||||
|
private readonly youtubeService = inject(YoutubeControllerService);
|
||||||
|
searchResults: WritableSignal<MusicRecord[]> = signal([]);
|
||||||
|
searchQuery: string = '';
|
||||||
|
|
||||||
|
performSearch(): void {
|
||||||
|
const queryDto: QueryDto = {
|
||||||
|
queryString: this.searchQuery,
|
||||||
|
};
|
||||||
|
|
||||||
|
this.youtubeService.query(queryDto).subscribe({
|
||||||
|
next: (results) => {
|
||||||
|
this.searchResults.set(results);
|
||||||
|
console.log(this.searchResults);
|
||||||
|
console.log('Query results:', results);
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.error('Query error:', error);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ public class YoutubeController {
|
|||||||
|
|
||||||
|
|
||||||
@PostMapping("/query")
|
@PostMapping("/query")
|
||||||
public ResponseEntity<List<MusicRecord>> createProduct(@RequestBody QueryDto queryDto ) {
|
public ResponseEntity<List<MusicRecord>> query(@RequestBody QueryDto queryDto ) {
|
||||||
return ResponseEntity.ok(ytService.query(queryDto));
|
return ResponseEntity.ok(ytService.query(queryDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user