Skip to content

Commit

Permalink
feat: Updateapi and schema.ts to use new language package
Browse files Browse the repository at this point in the history
  • Loading branch information
Kariamos committed Oct 17, 2024
1 parent 2c7e1f4 commit c200a8f
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 131 deletions.
140 changes: 57 additions & 83 deletions src/services/tryberApi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1464,34 +1464,8 @@ export type PutCampaignsByCampaignTasksAndTaskApiArg = {
};
export type GetCampaignsByCampaignUxApiResponse =
/** status 200 A UseCase linked with the Campaign */ {
status: "draft" | "published" | "draft-modified";
goal: string;
usersNumber: number;
insights?: {
id: number;
title: string;
severity: {
id: number;
name: string;
};
description: string;
clusters:
| "all"
| {
id: number;
name: string;
}[];
videoParts: {
id: number;
start: number;
end: number;
mediaId: number;
url: string;
streamUrl: string;
description: string;
poster?: string;
}[];
}[];
sentiments: {
id: number;
value: number;
Expand All @@ -1510,6 +1484,7 @@ export type GetCampaignsByCampaignUxApiResponse =
id: number;
name: string;
}[];
visible: number;
};
export type GetCampaignsByCampaignUxApiArg = {
/** A campaign id */
Expand All @@ -1519,44 +1494,25 @@ export type PatchCampaignsByCampaignUxApiResponse = /** status 200 OK */ {};
export type PatchCampaignsByCampaignUxApiArg = {
/** A campaign id */
campaign: string;
body:
| {
goal: string;
usersNumber: number;
insights: {
id?: number;
title: string;
description: string;
severityId: number;
order: number;
clusterIds: number[] | "all";
videoParts: {
id?: number;
start: number;
end: number;
mediaId: number;
description: string;
order: number;
}[];
}[];
sentiments: {
id?: number;
clusterId: number;
value: number;
comment: string;
}[];
methodology: {
type: "qualitative" | "quantitative" | "quali-quantitative";
description: string;
};
questions: {
id?: number;
name: string;
}[];
}
| {
status: "publish";
};
body: {
goal?: string;
usersNumber?: number;
visible?: number;
methodology?: {
description: string;
type: string;
};
sentiments?: {
clusterId: number;
value: number;
comment: string;
id?: number;
}[];
questions?: {
name: string;
id?: number;
}[];
};
};
export type PostCampaignsFormsApiResponse = /** status 201 Created */ {
id: number;
Expand Down Expand Up @@ -1899,7 +1855,6 @@ export type GetUsersMeApiResponse = /** status 200 OK */ {
gross: Currency;
};
languages?: {
id?: number;
name?: string;
}[];
onboarding_completed?: boolean;
Expand Down Expand Up @@ -2173,7 +2128,9 @@ export type GetUsersMeCampaignsByCampaignIdDevicesApiArg = {
campaignId: string;
};
export type GetUsersMeCampaignsByCampaignIdFormsApiResponse =
/** status 200 OK */ (PreselectionFormQuestion & {
/** status 200 OK */ ({
question: string;
short_name?: string;
value?:
| number
| {
Expand All @@ -2187,7 +2144,19 @@ export type GetUsersMeCampaignsByCampaignIdFormsApiResponse =
error?: string;
};
id: number;
})[];
} & (
| {
type: PreselectionQuestionSimple;
}
| {
type: PreselectionQuestionMultiple;
options: string[];
}
| {
type: PreselectionQuestionCuf;
options?: number[];
}
))[];
export type GetUsersMeCampaignsByCampaignIdFormsApiArg = {
campaignId: string;
};
Expand Down Expand Up @@ -2412,20 +2381,18 @@ export type PutUsersMeFiscalApiArg = {
};
};
export type PostUsersMeLanguagesApiResponse = /** status 201 Created */ {
id: string;
name: string;
};
export type PostUsersMeLanguagesApiArg = {
body: {
languageId?: number;
language_name?: string;
};
};
export type PutUsersMeLanguagesApiResponse = /** status 200 OK */ {
id?: number;
name?: string;
}[];
export type PutUsersMeLanguagesApiArg = {
body: number[];
body: string[];
};
export type DeleteUsersMeLanguagesByLanguageIdApiResponse =
/** status 200 OK */ {
Expand Down Expand Up @@ -2670,7 +2637,6 @@ export type GetDossiersByCampaignApiResponse = /** status 200 OK */ {
};
countries?: CountryCode[];
languages?: {
id: number;
name: string;
}[];
browsers?: {
Expand Down Expand Up @@ -2872,25 +2838,33 @@ export type TaskRequired = {
campaign_id: number;
};
export type Task = TaskOptional & TaskRequired;
export type PreselectionQuestionSimple =
| "gender"
| "text"
| "phone_number"
| "address";
export type PreselectionQuestionMultiple = "multiselect" | "select" | "radio";
export type PreselectionQuestionCuf = string;
export type PreselectionFormQuestion = {
question: string;
short_name?: string;
} & (
| {
type: "text";
}
| {
type: "multiselect" | "select" | "radio";
options: string[];
invalidOptions?: string[];
type: PreselectionQuestionSimple;
}
| {
type: string;
options?: number[];
invalidOptions?: number[];
type: PreselectionQuestionMultiple;
options?: {
value: string;
isInvalid?: boolean;
}[];
}
| {
type: "gender" | "phone_number" | "address";
type: PreselectionQuestionCuf;
options?: {
value: number;
isInvalid?: boolean;
}[];
}
);
export type CustomUserFieldsType = "text" | "select" | "multiselect";
Expand Down Expand Up @@ -3044,7 +3018,7 @@ export type DossierCreationData = {
cap?: number;
};
countries?: CountryCode[];
languages?: number[];
languages?: string[];
browsers?: number[];
productType?: number;
notes?: string;
Expand Down
Loading

0 comments on commit c200a8f

Please sign in to comment.