Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { environment } from '../../../environments/environment';
import { Resource } from 'ngx-resource-factory/resource/resource';
import { ResourceConfiguration } from 'ngx-resource-factory/resource/resource-configuration';
import { ResourceInstance } from 'ngx-resource-factory/resource/resource-instance';
export class Language extends ResourceInstance {
pk: number;
url: string;
name: string;
snippet_count: number;
}
@Injectable()
@ResourceConfiguration({
name: 'LanguageResource',
url: environment.apiUrl + 'language/:pk/',
pkAttr: 'pk',
instanceClass: Language,
stripTrailingSlashes: false,
})
export class LanguageResource extends Resource {
}
import { ResourceConfiguration } from 'ngx-resource-factory/resource/resource-configuration';
import { ResourceInstance } from 'ngx-resource-factory/resource/resource-instance';
import { ResourceActionMethod } from "ngx-resource-factory/resource/resource-action-method";
import { ResourceActionHttpMethod } from "ngx-resource-factory/resource/resource-action-http-method";
import { ResourceAction } from "ngx-resource-factory/resource/resource-action";
export class User extends ResourceInstance {
pk: number;
url: string;
username: string;
email: string;
}
@Injectable()
@ResourceConfiguration({
name: 'UserResource',
url: environment.apiUrl + 'user/:pk/',
pkAttr: 'pk',
instanceClass: User,
stripTrailingSlashes: false,
})
export class UserResource extends Resource {
@ResourceAction({
method: ResourceActionHttpMethod.GET,
isList: false,
invalidateCache: true,
urlSuffix: 'current/',
})
current: ResourceActionMethod;
pk: number;
url: string;
title: string;
description: string;
visibility: string;
user: number;
labels: number[];
files: SnippetFile[];
team: number;
user_display: string;
created_date: string;
modified_date: string;
}
@Injectable()
@ResourceConfiguration({
name: 'SnippetResource',
url: environment.apiUrl + 'snippet/:pk/',
pkAttr: 'pk',
instanceClass: Snippet,
stripTrailingSlashes: false,
})
export class SnippetResource extends Resource {
}
import { Subject } from "rxjs";
import { ResourceRegistry } from "ngx-resource-factory/resource/resource-registry";
import { HttpClient } from "@angular/common/http";
import { ResourceModel } from "ngx-resource-factory/resource/resource-model";
const AUTH_TOKEN = 'auth.token';
export type AuthCredentials = {
username: string;
password: string;
}
@Injectable()
@ResourceConfiguration({
name: 'AuthResource',
url: environment.apiUrl + 'auth/token/:pk/',
pkAttr: 'pk',
instanceClass: User,
stripTrailingSlashes: false,
})
export class AuthResource extends Resource {
isLoggedId = false;
currentUser: ResourceModel = null;
loginStatusUpdates: Subject = new Subject();
constructor(registry: ResourceRegistry,
http: HttpClient,
private userResource: UserResource) {
super(registry, http);
import { environment } from '../../../environments/environment';
import { Resource } from 'ngx-resource-factory/resource/resource';
import { ResourceConfiguration } from 'ngx-resource-factory/resource/resource-configuration';
import { ResourceInstance } from 'ngx-resource-factory/resource/resource-instance';
export class Label extends ResourceInstance {
pk: number;
url: string;
name: string;
snippet_count: number;
}
@Injectable()
@ResourceConfiguration({
name: 'LabelResource',
url: environment.apiUrl + 'label/:pk/',
pkAttr: 'pk',
instanceClass: Label,
stripTrailingSlashes: false,
})
export class LabelResource extends Resource<label> {
}
</label>
CONTRIBUTOR = 'CONTRIBUTOR',
EDITOR = 'EDITOR',
}
export class UserTeam extends ResourceInstance {
pk: number;
url: string;
user: number;
team: number;
user_display: string;
snippet_count: number;
role: ROLES;
}
@Injectable()
@ResourceConfiguration({
name: 'UserTeamResource',
url: environment.apiUrl + 'userteam/:pk/',
pkAttr: 'pk',
instanceClass: UserTeam,
stripTrailingSlashes: false,
})
export class UserTeamResource extends Resource {
}