Skip to content

Commit

Permalink
feat: updated api and schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Kariamos committed Oct 17, 2024
1 parent 9045b6b commit a829013
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 41 deletions.
86 changes: 50 additions & 36 deletions src/services/tryberApi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,6 @@ export type PutCampaignsByCampaignTasksAndTaskApiArg = {
};
export type GetCampaignsByCampaignUxApiResponse =
/** status 200 A UseCase linked with the Campaign */ {
status: "draft" | "published" | "draft-modified";
goal: string;
usersNumber: number;
sentiments: {
Expand All @@ -1485,6 +1484,7 @@ export type GetCampaignsByCampaignUxApiResponse =
id: number;
name: string;
}[];
visible: number;
};
export type GetCampaignsByCampaignUxApiArg = {
/** A campaign id */
Expand All @@ -1494,28 +1494,25 @@ export type PatchCampaignsByCampaignUxApiResponse = /** status 200 OK */ {};
export type PatchCampaignsByCampaignUxApiArg = {
/** A campaign id */
campaign: string;
body:
| {
goal: string;
usersNumber: 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 @@ -1859,7 +1856,6 @@ export type GetUsersMeApiResponse = /** status 200 OK */ {
gross: Currency;
};
languages?: {
id?: number;
name?: string;
}[];
onboarding_completed?: boolean;
Expand Down Expand Up @@ -2133,7 +2129,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 @@ -2147,7 +2145,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 @@ -2372,20 +2382,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 @@ -2630,7 +2638,6 @@ export type GetDossiersByCampaignApiResponse = /** status 200 OK */ {
};
countries?: CountryCode[];
languages?: {
id: number;
name: string;
}[];
browsers?: {
Expand Down Expand Up @@ -2832,22 +2839,29 @@ 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" | "gender" | "phone_number" | "address";
type: PreselectionQuestionSimple;
}
| {
type: "multiselect" | "select" | "radio";
options: {
type: PreselectionQuestionMultiple;
options?: {
value: string;
isInvalid?: boolean;
}[];
}
| {
type: string;
type: PreselectionQuestionCuf;
options?: {
value: number;
isInvalid?: boolean;
Expand Down Expand Up @@ -3005,7 +3019,7 @@ export type DossierCreationData = {
cap?: number;
};
countries?: CountryCode[];
languages?: number[];
languages?: string[];
browsers?: number[];
productType?: number;
notes?: string;
Expand Down
7 changes: 2 additions & 5 deletions src/utils/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2867,7 +2867,6 @@ export interface operations {
gross: components["schemas"]["Currency"];
};
languages?: {
id?: number;
name?: string;
}[];
onboarding_completed?: boolean;
Expand Down Expand Up @@ -3776,7 +3775,6 @@ export interface operations {
200: {
content: {
"application/json": {
id?: number;
name?: string;
}[];
};
Expand All @@ -3785,7 +3783,7 @@ export interface operations {
};
requestBody: {
content: {
"application/json": number[];
"application/json": string[];
};
};
};
Expand All @@ -3796,7 +3794,6 @@ export interface operations {
201: {
content: {
"application/json": {
id: string;
name: string;
};
};
Expand All @@ -3806,7 +3803,7 @@ export interface operations {
requestBody: {
content: {
"application/json": {
languageId?: number;
language_name?: string;
};
};
};
Expand Down

0 comments on commit a829013

Please sign in to comment.