Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getCurrentUser(username?: string, password?: string): Observable {
if (this.conf.config.useBasicAuth && username && password) {
this.apiConf.username = username;
this.apiConf.password = password;
}
// the added timestamp of the query string forces legacy browsers to not cache the http response
// for current user. this fixes current user differentiated tests.
const search = new URLSearchParams(`v=${Date.now()}`.toString());
return this.currentUserApi.currentUserGetCurrentUserWithHttpInfo({search}).map((res) => {
this.userAuthorizations = res.json();
this._user.next(res.json());
this.encryptedUserIdentifier = this.encryptionService.encryptAndGet((res.json() as UserAuthorizations).userId);
return res.json();
});
}
query(req: any): Observable {
const params: URLSearchParams = new URLSearchParams();
params.set('fromDate', req.fromDate);
params.set('toDate', req.toDate);
params.set('desc', 'true');
params.set('page', req.page);
params.set('size', req.size);
params.set('sort', req.sort);
const options = {
search: params
};
return this.http.get('management/audits', options);
}
}
getMovieReviews(id: string) {
var search = new URLSearchParams();
search.set('api_key', this.apikey);
return this._jsonp.get('https://api.themoviedb.org/3/movie/'+ id +'/reviews?callback=JSONP_CALLBACK', {search})
.map(res => {
return res.json();
})
}
getMovieVideos(id: string) {
private buildUrlSearchParams(params: any): URLSearchParams {
let searchParams = new URLSearchParams();
for (let key in params) {
if (params.hasOwnProperty(key)) {
searchParams.append(key, params[key]);
}
}
return searchParams;
}
function AppComponent() {
this.example = 'rich-grid';
var params = new http_1.URLSearchParams(window.location.search.replace("?", ""));
this.example = params.get('example') ? params.get("example") : 'rich-grid';
}
AppComponent = __decorate([
getSlideToSearch(textToSearch, pageIndex, pageSize): Observable {
const params: URLSearchParams = new URLSearchParams();
params.set('title', textToSearch.title);
params.set('state', textToSearch.filter);
params.set('favorite', textToSearch.favorite);
params.set('username', this.user.username);
params.set('pageIndex', pageIndex);
params.set('pageSize', pageSize);
params.set('order', textToSearch.order);
const backendURL = `${this._baseUrl}/${environment.backend.endpoints.search}`;
return this.http.get(backendURL, { params: params }).map((response: Response) => response.json());
}
getMoviesByGenre(id: string) {
var search = new URLSearchParams();
search.set('api_key', this.apikey);
return this._jsonp.get('https://api.themoviedb.org/3/genre/'+ id +'/movies?callback=JSONP_CALLBACK', {search})
.map(res => {
return res.json();
})
}
getTeamProfile(organization: string, team: string): Observable {
let params: URLSearchParams = new URLSearchParams();
params.set('organization', organization);
params.set('team', team);
return this.get(`${this.url}/org/team/profile`, params);
}
query(req: any): Observable {
const params: URLSearchParams = new URLSearchParams();
params.set('fromDate', req.fromDate);
params.set('toDate', req.toDate);
params.set('page', req.page);
params.set('size', req.size);
params.set('sort', req.sort);
const options = {
search: params
};
return this.http.get(SERVER_API_URL + 'management/audits', options);
}
}
public allSessionsFriday(extraHttpRequestParams?: any): Observable> {
const path = this.basePath + '/sessions/friday';
let queryParameters = new URLSearchParams();
let headerParams = this.defaultHeaders;
let requestOptions: RequestOptionsArgs = {
method: 'GET',
headers: headerParams,
search: queryParameters
};
return this.http.request(path, requestOptions)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return this.getResponse(response);
}
});
}