iubenda-consent-solution-api
Version:
API client to implement Iubenda Consent Solution in backend service
30 lines (29 loc) • 1.3 kB
TypeScript
import { ConsentExtended, ConsentPostResponse, ConsentResponse, ConsentsQueryParameters } from './consent';
import { Subject, SubjectPostResponse, SubjectQueryParameters, SubjectResponse } from './subject';
export interface ResponseError {
error: boolean;
status: number;
message: string;
}
export interface ClientOption {
apiKey: string;
beta?: boolean;
unescape_json?: boolean;
}
export declare class IubendaConsentSolution {
apiKey: string;
beta: boolean;
unescape_json: boolean;
constructor(options: ClientOption);
get apiUrl(): string;
private addHeaders;
private generateUrl;
private static sendRequest;
getConsents(query?: ConsentsQueryParameters): Promise<ResponseError | ConsentResponse[]>;
getConsent(id: string): Promise<ResponseError | ConsentExtended>;
createConsent(consent: ConsentExtended): Promise<ResponseError | ConsentPostResponse>;
getSubjects(query?: SubjectQueryParameters): Promise<ResponseError | SubjectResponse[]>;
getSubject(id: string): Promise<ResponseError | SubjectResponse>;
createSubject(subject: Subject): Promise<ResponseError | SubjectPostResponse | null>;
updateSubject(subject: Subject, id: string): Promise<ResponseError | SubjectPostResponse>;
}