diff options
Diffstat (limited to 'src')
206 files changed, 17188 insertions, 0 deletions
diff --git a/src/ViewContext.tsx b/src/ViewContext.tsx new file mode 100644 index 0000000..7946052 --- /dev/null +++ b/src/ViewContext.tsx @@ -0,0 +1,43 @@ +// import { createContext, useContext, useState, ReactNode } from 'react'; +// import {ProfilingQuestion} from "@/models/question.ts" +// +// type View = 'offerwall' | 'questions' | 'cashout'; +// +// type ViewContextType = { +// activeView: View; +// setActiveView: (view: View) => void; +// }; +// +// type ProfilingQuestionMap = Map<string, ProfilingQuestion>; +// +// interface ProfilingQuestionsContextType { +// answers: ProfilingQuestionMap; +// setAnswer: (questionId: string, values: string[]) => void; +// clearAnswers: () => void; +// } +// +// interface ProfilingQuestionsContextType { +// questions: ProfilingQuestion[]; +// setQuestions: (questions: ProfilingQuestion[]) => void; +// getQuestionById: (id: string) => ProfilingQuestion | undefined; +// } +// +// const ViewContext = createContext<ViewContextType | undefined>(undefined); +// +// export function useViewContext() { +// const context = useContext(ViewContext); +// if (!context) { +// throw new Error('useViewContext must be used within a ViewProvider'); +// } +// return context; +// } +// +// export function ViewProvider({ children }: { children: ReactNode }) { +// const [activeView, setActiveView] = useState<View>('offerwall'); +// +// return ( +// <ViewContext.Provider value={{ activeView, setActiveView }}> +// {children} +// </ViewContext.Provider> +// ); +// }
\ No newline at end of file diff --git a/src/Widget.tsx b/src/Widget.tsx new file mode 100644 index 0000000..99c2a33 --- /dev/null +++ b/src/Widget.tsx @@ -0,0 +1,61 @@ +import React, {useEffect} from 'react' +import {AppSidebar} from "@/components/app-sidebar" +import {SiteHeader} from "@/components/site-header" +import {SidebarInset, SidebarProvider} from "@/components/ui/sidebar" +import {Offerwall} from "@/pages/Offerwall.tsx" +import {QuestionsPage} from "@/pages/Questions.tsx"; + +import {useAppDispatch, useAppSelector} from "@/hooks.ts"; +import {OfferwallApi, ProfilingQuestionsApi} from "@/api"; +import {setBuckets} from "@/models/bucketSlice.ts"; +import {setQuestions} from "@/models/questionSlice.ts" +import {CashoutMethodsPage} from "@/pages/CashoutMethods.tsx"; + +import './index.css'; + + +const Widget = () => { + + const dispatch = useAppDispatch() + const app = useAppSelector(state => state.app) + + useEffect(() => { + // https://fsb.generalresearch.com/{product_id}/offerwall/37d1da64/?country + new OfferwallApi().offerwallSoftpairProductIdOfferwall37d1da64Get(app.bpid, app.bpuid, "104.9.125.144") + .then(res => { + dispatch(setBuckets(res.data.offerwall.buckets)) + }) + .catch(err => console.log(err)); + + new ProfilingQuestionsApi().getProfilingQuestionsProductIdProfilingQuestionsGet(app.bpid, app.bpuid, "104.9.125.144") + .then(res => { + dispatch(setQuestions(res.data.questions)) + }) + .catch(err => console.log(err)); + }, []); // ← empty array means "run once" + + + return ( + <SidebarProvider> + <AppSidebar variant="floating" /> + <SidebarInset> + <SiteHeader/> + + <div className="flex flex-1 flex-col"> + <div className="@container/main flex flex-1 flex-col gap-2"> + <div className="flex flex-col gap-4 py-4 md:gap-6 md:py-6"> + <div className="px-4 lg:px-6"> + {app.currentPage === 'offerwall' && <Offerwall/>} + {app.currentPage === 'questions' && <QuestionsPage/>} + {app.currentPage === 'cashouts' && <CashoutMethodsPage/>} + </div> + </div> + </div> + </div> + + </SidebarInset> + </SidebarProvider> + ) +} + +export {Widget} diff --git a/src/api/README.md b/src/api/README.md new file mode 100644 index 0000000..9fffca2 --- /dev/null +++ b/src/api/README.md @@ -0,0 +1,45 @@ +## @1.0.0 + +This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments: + +Environment +* Node.js +* Webpack +* Browserify + +Language level +* ES5 - you must have a Promises/A+ library installed +* ES6 + +Module system +* CommonJS +* ES6 module system + +It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) + +### Building + +To build and compile the typescript sources to javascript use: +``` +npm install +npm run build +``` + +### Publishing + +First build the package then run ```npm publish``` + +### Consuming + +navigate to the folder of your consuming project and run one of the following commands. + +_published:_ + +``` +npm install @1.0.0 --save +``` + +_unPublished (not recommended):_ + +``` +npm install PATH_TO_GENERATED_PACKAGE --save diff --git a/src/api/api.ts b/src/api/api.ts new file mode 100644 index 0000000..f54d5ed --- /dev/null +++ b/src/api/api.ts @@ -0,0 +1,21 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +export * from './apis/dashboard-api'; +export * from './apis/leaderboard-api'; +export * from './apis/offerwall-api'; +export * from './apis/profiling-questions-api'; +export * from './apis/report-api'; +export * from './apis/status-api'; +export * from './apis/wallet-api'; + diff --git a/src/api/apis/dashboard-api.ts b/src/api/apis/dashboard-api.ts new file mode 100644 index 0000000..f35213a --- /dev/null +++ b/src/api/apis/dashboard-api.ts @@ -0,0 +1,134 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import globalAxios, { AxiosResponse, AxiosInstance, AxiosRequestConfig } from 'axios'; +import { Configuration } from '../configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; +import { HTTPValidationError } from '../models'; +import { MarketplaceSummary } from '../models'; +/** + * DashboardApi - axios parameter creator + * @export + */ +export const DashboardApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Marketplace Inventory + * @param {any} marketplace + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + marketplaceInventoryDashboardInventoryGet: async (marketplace: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'marketplace' is not null or undefined + if (marketplace === null || marketplace === undefined) { + throw new RequiredError('marketplace','Required parameter marketplace was null or undefined when calling marketplaceInventoryDashboardInventoryGet.'); + } + const localVarPath = `/dashboard/inventory/`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (marketplace !== undefined) { + localVarQueryParameter['marketplace'] = marketplace; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * DashboardApi - functional programming interface + * @export + */ +export const DashboardApiFp = function(configuration?: Configuration) { + return { + /** + * + * @summary Marketplace Inventory + * @param {any} marketplace + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async marketplaceInventoryDashboardInventoryGet(marketplace: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<MarketplaceSummary>>> { + const localVarAxiosArgs = await DashboardApiAxiosParamCreator(configuration).marketplaceInventoryDashboardInventoryGet(marketplace, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * DashboardApi - factory interface + * @export + */ +export const DashboardApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + return { + /** + * + * @summary Marketplace Inventory + * @param {any} marketplace + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async marketplaceInventoryDashboardInventoryGet(marketplace: any, options?: AxiosRequestConfig): Promise<AxiosResponse<MarketplaceSummary>> { + return DashboardApiFp(configuration).marketplaceInventoryDashboardInventoryGet(marketplace, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * DashboardApi - object-oriented interface + * @export + * @class DashboardApi + * @extends {BaseAPI} + */ +export class DashboardApi extends BaseAPI { + /** + * + * @summary Marketplace Inventory + * @param {any} marketplace + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DashboardApi + */ + public async marketplaceInventoryDashboardInventoryGet(marketplace: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<MarketplaceSummary>> { + return DashboardApiFp(this.configuration).marketplaceInventoryDashboardInventoryGet(marketplace, options).then((request) => request(this.axios, this.basePath)); + } +} diff --git a/src/api/apis/leaderboard-api.ts b/src/api/apis/leaderboard-api.ts new file mode 100644 index 0000000..26e8c95 --- /dev/null +++ b/src/api/apis/leaderboard-api.ts @@ -0,0 +1,301 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import globalAxios, { AxiosResponse, AxiosInstance, AxiosRequestConfig } from 'axios'; +import { Configuration } from '../configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; +import { HTTPValidationError } from '../models'; +import { LeaderboardResponse } from '../models'; +import { LeaderboardWinnerResponse } from '../models'; +/** + * LeaderboardApi - axios parameter creator + * @export + */ +export const LeaderboardApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Get the Winners of leaderboard contests + * @summary Leaderboard Winners + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} boardCode The type of leaderboard. What the \"values\" represent. Allowed values: - __complete_count__ *(COMPLETE_COUNT)*: Number of Completes - __largest_user_payout__ *(LARGEST_PAYOUT)*: Largest Single Payout - __sum_user_payout__ *(SUM_PAYOUTS)*: (Sum of) Total Payouts + * @param {any} freq The time period range for the leaderboard. Allowed values: - __daily__ *(DAILY)*: UTC midnight to UTC midnight - __weekly__ *(WEEKLY)*: Sunday Midnight to Sunday Midnight UTC - __monthly__ *(MONTHLY)*: Jan 1 00:00:00 + * @param {any} countryIso Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + leaderboardWinnersProductIdLeaderboardTimespanBoardCodeWinnersGet: async (productId: any, boardCode: any, freq: any, countryIso: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling leaderboardWinnersProductIdLeaderboardTimespanBoardCodeWinnersGet.'); + } + // verify required parameter 'boardCode' is not null or undefined + if (boardCode === null || boardCode === undefined) { + throw new RequiredError('boardCode','Required parameter boardCode was null or undefined when calling leaderboardWinnersProductIdLeaderboardTimespanBoardCodeWinnersGet.'); + } + // verify required parameter 'freq' is not null or undefined + if (freq === null || freq === undefined) { + throw new RequiredError('freq','Required parameter freq was null or undefined when calling leaderboardWinnersProductIdLeaderboardTimespanBoardCodeWinnersGet.'); + } + // verify required parameter 'countryIso' is not null or undefined + if (countryIso === null || countryIso === undefined) { + throw new RequiredError('countryIso','Required parameter countryIso was null or undefined when calling leaderboardWinnersProductIdLeaderboardTimespanBoardCodeWinnersGet.'); + } + const localVarPath = `/{product_id}/leaderboard/timespan/{board_code}/winners/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))) + .replace(`{${"board_code"}}`, encodeURIComponent(String(boardCode))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (freq !== undefined) { + localVarQueryParameter['freq'] = freq; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Timespan Leaderboard + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} boardCode The type of leaderboard. What the \"values\" represent. Allowed values: - __complete_count__ *(COMPLETE_COUNT)*: Number of Completes - __largest_user_payout__ *(LARGEST_PAYOUT)*: Largest Single Payout - __sum_user_payout__ *(SUM_PAYOUTS)*: (Sum of) Total Payouts + * @param {any} freq The time period range for the leaderboard. Allowed values: - __daily__ *(DAILY)*: UTC midnight to UTC midnight - __weekly__ *(WEEKLY)*: Sunday Midnight to Sunday Midnight UTC - __monthly__ *(MONTHLY)*: Jan 1 00:00:00 + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [bpuid] Brokerage Product User ID. If passed, then the country is not required; the country is determined by this user's latest IP. + * @param {any} [timestamp] The start timestamp for the requested leaderboard. If NULL, uses the current time period. + * @param {any} [scope] If scope is \"user\", then `bp_user_id` must be set. Results in filtering rows to include only this user's row, plus rows above and below in rank (up to `limit` rows). If \"global\", then the top `limit` rows are returned. + * @param {any} [limit] Max number of rows to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + timespanLeaderboardProductIdLeaderboardTimespanBoardCodeGet: async (productId: any, boardCode: any, freq: any, countryIso?: any, bpuid?: any, timestamp?: any, scope?: any, limit?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling timespanLeaderboardProductIdLeaderboardTimespanBoardCodeGet.'); + } + // verify required parameter 'boardCode' is not null or undefined + if (boardCode === null || boardCode === undefined) { + throw new RequiredError('boardCode','Required parameter boardCode was null or undefined when calling timespanLeaderboardProductIdLeaderboardTimespanBoardCodeGet.'); + } + // verify required parameter 'freq' is not null or undefined + if (freq === null || freq === undefined) { + throw new RequiredError('freq','Required parameter freq was null or undefined when calling timespanLeaderboardProductIdLeaderboardTimespanBoardCodeGet.'); + } + const localVarPath = `/{product_id}/leaderboard/timespan/{board_code}/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))) + .replace(`{${"board_code"}}`, encodeURIComponent(String(boardCode))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (freq !== undefined) { + localVarQueryParameter['freq'] = freq; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (timestamp !== undefined) { + localVarQueryParameter['timestamp'] = timestamp; + } + + if (scope !== undefined) { + localVarQueryParameter['scope'] = scope; + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * LeaderboardApi - functional programming interface + * @export + */ +export const LeaderboardApiFp = function(configuration?: Configuration) { + return { + /** + * Get the Winners of leaderboard contests + * @summary Leaderboard Winners + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} boardCode The type of leaderboard. What the \"values\" represent. Allowed values: - __complete_count__ *(COMPLETE_COUNT)*: Number of Completes - __largest_user_payout__ *(LARGEST_PAYOUT)*: Largest Single Payout - __sum_user_payout__ *(SUM_PAYOUTS)*: (Sum of) Total Payouts + * @param {any} freq The time period range for the leaderboard. Allowed values: - __daily__ *(DAILY)*: UTC midnight to UTC midnight - __weekly__ *(WEEKLY)*: Sunday Midnight to Sunday Midnight UTC - __monthly__ *(MONTHLY)*: Jan 1 00:00:00 + * @param {any} countryIso Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async leaderboardWinnersProductIdLeaderboardTimespanBoardCodeWinnersGet(productId: any, boardCode: any, freq: any, countryIso: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<LeaderboardWinnerResponse>>> { + const localVarAxiosArgs = await LeaderboardApiAxiosParamCreator(configuration).leaderboardWinnersProductIdLeaderboardTimespanBoardCodeWinnersGet(productId, boardCode, freq, countryIso, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Timespan Leaderboard + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} boardCode The type of leaderboard. What the \"values\" represent. Allowed values: - __complete_count__ *(COMPLETE_COUNT)*: Number of Completes - __largest_user_payout__ *(LARGEST_PAYOUT)*: Largest Single Payout - __sum_user_payout__ *(SUM_PAYOUTS)*: (Sum of) Total Payouts + * @param {any} freq The time period range for the leaderboard. Allowed values: - __daily__ *(DAILY)*: UTC midnight to UTC midnight - __weekly__ *(WEEKLY)*: Sunday Midnight to Sunday Midnight UTC - __monthly__ *(MONTHLY)*: Jan 1 00:00:00 + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [bpuid] Brokerage Product User ID. If passed, then the country is not required; the country is determined by this user's latest IP. + * @param {any} [timestamp] The start timestamp for the requested leaderboard. If NULL, uses the current time period. + * @param {any} [scope] If scope is \"user\", then `bp_user_id` must be set. Results in filtering rows to include only this user's row, plus rows above and below in rank (up to `limit` rows). If \"global\", then the top `limit` rows are returned. + * @param {any} [limit] Max number of rows to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async timespanLeaderboardProductIdLeaderboardTimespanBoardCodeGet(productId: any, boardCode: any, freq: any, countryIso?: any, bpuid?: any, timestamp?: any, scope?: any, limit?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<LeaderboardResponse>>> { + const localVarAxiosArgs = await LeaderboardApiAxiosParamCreator(configuration).timespanLeaderboardProductIdLeaderboardTimespanBoardCodeGet(productId, boardCode, freq, countryIso, bpuid, timestamp, scope, limit, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * LeaderboardApi - factory interface + * @export + */ +export const LeaderboardApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + return { + /** + * Get the Winners of leaderboard contests + * @summary Leaderboard Winners + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} boardCode The type of leaderboard. What the \"values\" represent. Allowed values: - __complete_count__ *(COMPLETE_COUNT)*: Number of Completes - __largest_user_payout__ *(LARGEST_PAYOUT)*: Largest Single Payout - __sum_user_payout__ *(SUM_PAYOUTS)*: (Sum of) Total Payouts + * @param {any} freq The time period range for the leaderboard. Allowed values: - __daily__ *(DAILY)*: UTC midnight to UTC midnight - __weekly__ *(WEEKLY)*: Sunday Midnight to Sunday Midnight UTC - __monthly__ *(MONTHLY)*: Jan 1 00:00:00 + * @param {any} countryIso Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async leaderboardWinnersProductIdLeaderboardTimespanBoardCodeWinnersGet(productId: any, boardCode: any, freq: any, countryIso: any, options?: AxiosRequestConfig): Promise<AxiosResponse<LeaderboardWinnerResponse>> { + return LeaderboardApiFp(configuration).leaderboardWinnersProductIdLeaderboardTimespanBoardCodeWinnersGet(productId, boardCode, freq, countryIso, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Timespan Leaderboard + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} boardCode The type of leaderboard. What the \"values\" represent. Allowed values: - __complete_count__ *(COMPLETE_COUNT)*: Number of Completes - __largest_user_payout__ *(LARGEST_PAYOUT)*: Largest Single Payout - __sum_user_payout__ *(SUM_PAYOUTS)*: (Sum of) Total Payouts + * @param {any} freq The time period range for the leaderboard. Allowed values: - __daily__ *(DAILY)*: UTC midnight to UTC midnight - __weekly__ *(WEEKLY)*: Sunday Midnight to Sunday Midnight UTC - __monthly__ *(MONTHLY)*: Jan 1 00:00:00 + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [bpuid] Brokerage Product User ID. If passed, then the country is not required; the country is determined by this user's latest IP. + * @param {any} [timestamp] The start timestamp for the requested leaderboard. If NULL, uses the current time period. + * @param {any} [scope] If scope is \"user\", then `bp_user_id` must be set. Results in filtering rows to include only this user's row, plus rows above and below in rank (up to `limit` rows). If \"global\", then the top `limit` rows are returned. + * @param {any} [limit] Max number of rows to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async timespanLeaderboardProductIdLeaderboardTimespanBoardCodeGet(productId: any, boardCode: any, freq: any, countryIso?: any, bpuid?: any, timestamp?: any, scope?: any, limit?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<LeaderboardResponse>> { + return LeaderboardApiFp(configuration).timespanLeaderboardProductIdLeaderboardTimespanBoardCodeGet(productId, boardCode, freq, countryIso, bpuid, timestamp, scope, limit, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * LeaderboardApi - object-oriented interface + * @export + * @class LeaderboardApi + * @extends {BaseAPI} + */ +export class LeaderboardApi extends BaseAPI { + /** + * Get the Winners of leaderboard contests + * @summary Leaderboard Winners + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} boardCode The type of leaderboard. What the \"values\" represent. Allowed values: - __complete_count__ *(COMPLETE_COUNT)*: Number of Completes - __largest_user_payout__ *(LARGEST_PAYOUT)*: Largest Single Payout - __sum_user_payout__ *(SUM_PAYOUTS)*: (Sum of) Total Payouts + * @param {any} freq The time period range for the leaderboard. Allowed values: - __daily__ *(DAILY)*: UTC midnight to UTC midnight - __weekly__ *(WEEKLY)*: Sunday Midnight to Sunday Midnight UTC - __monthly__ *(MONTHLY)*: Jan 1 00:00:00 + * @param {any} countryIso Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof LeaderboardApi + */ + public async leaderboardWinnersProductIdLeaderboardTimespanBoardCodeWinnersGet(productId: any, boardCode: any, freq: any, countryIso: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<LeaderboardWinnerResponse>> { + return LeaderboardApiFp(this.configuration).leaderboardWinnersProductIdLeaderboardTimespanBoardCodeWinnersGet(productId, boardCode, freq, countryIso, options).then((request) => request(this.axios, this.basePath)); + } + /** + * + * @summary Timespan Leaderboard + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} boardCode The type of leaderboard. What the \"values\" represent. Allowed values: - __complete_count__ *(COMPLETE_COUNT)*: Number of Completes - __largest_user_payout__ *(LARGEST_PAYOUT)*: Largest Single Payout - __sum_user_payout__ *(SUM_PAYOUTS)*: (Sum of) Total Payouts + * @param {any} freq The time period range for the leaderboard. Allowed values: - __daily__ *(DAILY)*: UTC midnight to UTC midnight - __weekly__ *(WEEKLY)*: Sunday Midnight to Sunday Midnight UTC - __monthly__ *(MONTHLY)*: Jan 1 00:00:00 + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [bpuid] Brokerage Product User ID. If passed, then the country is not required; the country is determined by this user's latest IP. + * @param {any} [timestamp] The start timestamp for the requested leaderboard. If NULL, uses the current time period. + * @param {any} [scope] If scope is \"user\", then `bp_user_id` must be set. Results in filtering rows to include only this user's row, plus rows above and below in rank (up to `limit` rows). If \"global\", then the top `limit` rows are returned. + * @param {any} [limit] Max number of rows to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof LeaderboardApi + */ + public async timespanLeaderboardProductIdLeaderboardTimespanBoardCodeGet(productId: any, boardCode: any, freq: any, countryIso?: any, bpuid?: any, timestamp?: any, scope?: any, limit?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<LeaderboardResponse>> { + return LeaderboardApiFp(this.configuration).timespanLeaderboardProductIdLeaderboardTimespanBoardCodeGet(productId, boardCode, freq, countryIso, bpuid, timestamp, scope, limit, options).then((request) => request(this.axios, this.basePath)); + } +} diff --git a/src/api/apis/offerwall-api.ts b/src/api/apis/offerwall-api.ts new file mode 100644 index 0000000..a49c613 --- /dev/null +++ b/src/api/apis/offerwall-api.ts @@ -0,0 +1,2205 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import globalAxios, { AxiosResponse, AxiosInstance, AxiosRequestConfig } from 'axios'; +import { Configuration } from '../configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; +import { BodyOfferwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost } from '../models'; +import { HTTPValidationError } from '../models'; +import { MarketplaceOfferwallResponse } from '../models'; +import { OneShotOfferwallResponse } from '../models'; +import { SingleEntryOfferWallResponse } from '../models'; +import { SoftPairOfferwallResponse } from '../models'; +import { StarwallOfferWallResponse } from '../models'; +import { StarwallPlusBlockOfferWallResponse } from '../models'; +import { StarwallPlusBlockRecontactOfferWallResponse } from '../models'; +import { StarwallPlusOfferWallResponse } from '../models'; +import { TopNOfferWallResponse } from '../models'; +import { TopNPlusBlockOfferWallResponse } from '../models'; +import { TopNPlusBlockRecontactOfferWallResponse } from '../models'; +import { TopNPlusOfferWallResponse } from '../models'; +import { WXETOfferwallResponse } from '../models'; +/** + * OfferwallApi - axios parameter creator + * @export + */ +export const OfferwallApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Returns buckets grouped by marketplace, one per marketplace, with the tasks ordered by quality. + * @summary Marketplace Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + marketplaceOfferwallProductIdOfferwall5fa23085Get: async (productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, minBinSize?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling marketplaceOfferwallProductIdOfferwall5fa23085Get.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling marketplaceOfferwallProductIdOfferwall5fa23085Get.'); + } + const localVarPath = `/{product_id}/offerwall/5fa23085/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (ip !== undefined) { + localVarQueryParameter['ip'] = ip; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languages !== undefined) { + localVarQueryParameter['languages'] = languages; + } + + if (behavior !== undefined) { + localVarQueryParameter['behavior'] = behavior; + } + + if (minPayout !== undefined) { + localVarQueryParameter['min_payout'] = minPayout; + } + + if (duration !== undefined) { + localVarQueryParameter['duration'] = duration; + } + + if (minBinSize !== undefined) { + localVarQueryParameter['min_bin_size'] = minBinSize; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * This is a custom endpoint for a softpair-style offerwall that allows you to update profiling answers and then immediately get back the updated offerwall + * @summary Offerwall Softpair Post + * @param {BodyOfferwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost} body + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} offerwallId The offerwall ID the user is interacting with + * @param {any} sessionId A session id (uuid4.hex) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + offerwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost: async (body: BodyOfferwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost, bpuid: any, productId: any, offerwallId: any, sessionId: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling offerwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling offerwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost.'); + } + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling offerwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost.'); + } + // verify required parameter 'offerwallId' is not null or undefined + if (offerwallId === null || offerwallId === undefined) { + throw new RequiredError('offerwallId','Required parameter offerwallId was null or undefined when calling offerwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost.'); + } + // verify required parameter 'sessionId' is not null or undefined + if (sessionId === null || sessionId === undefined) { + throw new RequiredError('sessionId','Required parameter sessionId was null or undefined when calling offerwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost.'); + } + const localVarPath = `/{product_id}/offerwall/37d1da64/{offerwall_id}/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))) + .replace(`{${"offerwall_id"}}`, encodeURIComponent(String(offerwallId))) + .replace(`{${"session_id"}}`, encodeURIComponent(String(sessionId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * This offerwall contains tasks for which the user has a conditional eligibility. The questions that a user must answer to determine the eligibility are included within each bucket. Additionally, the question definitions are included for convenience. + * @summary Offerwall Softpair + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [maxOptions] Max number of options an allowed question can have (allowed to be asked) + * @param {any} [maxQuestions] Max number of missing questions on a single bin + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + offerwallSoftpairProductIdOfferwall37d1da64Get: async (productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, maxOptions?: any, maxQuestions?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling offerwallSoftpairProductIdOfferwall37d1da64Get.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling offerwallSoftpairProductIdOfferwall37d1da64Get.'); + } + const localVarPath = `/{product_id}/offerwall/37d1da64/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (ip !== undefined) { + localVarQueryParameter['ip'] = ip; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languages !== undefined) { + localVarQueryParameter['languages'] = languages; + } + + if (behavior !== undefined) { + localVarQueryParameter['behavior'] = behavior; + } + + if (minPayout !== undefined) { + localVarQueryParameter['min_payout'] = minPayout; + } + + if (duration !== undefined) { + localVarQueryParameter['duration'] = duration; + } + + if (nBins !== undefined) { + localVarQueryParameter['n_bins'] = nBins; + } + + if (minBinSize !== undefined) { + localVarQueryParameter['min_bin_size'] = minBinSize; + } + + if (maxOptions !== undefined) { + localVarQueryParameter['max_options'] = maxOptions; + } + + if (maxQuestions !== undefined) { + localVarQueryParameter['max_questions'] = maxQuestions; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Each bucket has only 1 single task, and only basic info is returned about each bucket. + * @summary One Shot Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [sources] Restrict tasks to those from these marketplaces only. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + oneShotOfferwallProductIdOfferwall6f27b1aeGet: async (productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, sources?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling oneShotOfferwallProductIdOfferwall6f27b1aeGet.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling oneShotOfferwallProductIdOfferwall6f27b1aeGet.'); + } + const localVarPath = `/{product_id}/offerwall/6f27b1ae/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (ip !== undefined) { + localVarQueryParameter['ip'] = ip; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languages !== undefined) { + localVarQueryParameter['languages'] = languages; + } + + if (behavior !== undefined) { + localVarQueryParameter['behavior'] = behavior; + } + + if (minPayout !== undefined) { + localVarQueryParameter['min_payout'] = minPayout; + } + + if (duration !== undefined) { + localVarQueryParameter['duration'] = duration; + } + + if (nBins !== undefined) { + localVarQueryParameter['n_bins'] = nBins; + } + + if (sources !== undefined) { + localVarQueryParameter['sources'] = sources; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Only returns a single bucket with the top scoring tasks. + * @summary Single Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + singleOfferwallProductIdOfferwall5fl8bpv5Get: async (productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, minBinSize?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling singleOfferwallProductIdOfferwall5fl8bpv5Get.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling singleOfferwallProductIdOfferwall5fl8bpv5Get.'); + } + const localVarPath = `/{product_id}/offerwall/5fl8bpv5/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (ip !== undefined) { + localVarQueryParameter['ip'] = ip; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languages !== undefined) { + localVarQueryParameter['languages'] = languages; + } + + if (behavior !== undefined) { + localVarQueryParameter['behavior'] = behavior; + } + + if (minPayout !== undefined) { + localVarQueryParameter['min_payout'] = minPayout; + } + + if (duration !== undefined) { + localVarQueryParameter['duration'] = duration; + } + + if (minBinSize !== undefined) { + localVarQueryParameter['min_bin_size'] = minBinSize; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Returns an offerwall with buckets that are clustered by setting as seeds the highest scoring surveys for each bin, then the rest are distributed according to their Euclidean distance using the bucket's features. + * @summary Starwall Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + starwallOfferwallProductIdOfferwallB59a2d2bGet: async (productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling starwallOfferwallProductIdOfferwallB59a2d2bGet.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling starwallOfferwallProductIdOfferwallB59a2d2bGet.'); + } + const localVarPath = `/{product_id}/offerwall/b59a2d2b/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (ip !== undefined) { + localVarQueryParameter['ip'] = ip; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languages !== undefined) { + localVarQueryParameter['languages'] = languages; + } + + if (behavior !== undefined) { + localVarQueryParameter['behavior'] = behavior; + } + + if (minPayout !== undefined) { + localVarQueryParameter['min_payout'] = minPayout; + } + + if (duration !== undefined) { + localVarQueryParameter['duration'] = duration; + } + + if (nBins !== undefined) { + localVarQueryParameter['n_bins'] = nBins; + } + + if (minBinSize !== undefined) { + localVarQueryParameter['min_bin_size'] = minBinSize; + } + + if (splitBy !== undefined) { + localVarQueryParameter['split_by'] = splitBy; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Same as the StarwallOfferWall, but the buckets include contents and no buckets are returned if the user is blocked. + * @summary Starwall Plus Block Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + starwallPlusBlockOfferwallProductIdOfferwall7fa1b3f4Get: async (productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling starwallPlusBlockOfferwallProductIdOfferwall7fa1b3f4Get.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling starwallPlusBlockOfferwallProductIdOfferwall7fa1b3f4Get.'); + } + const localVarPath = `/{product_id}/offerwall/7fa1b3f4/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (ip !== undefined) { + localVarQueryParameter['ip'] = ip; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languages !== undefined) { + localVarQueryParameter['languages'] = languages; + } + + if (behavior !== undefined) { + localVarQueryParameter['behavior'] = behavior; + } + + if (minPayout !== undefined) { + localVarQueryParameter['min_payout'] = minPayout; + } + + if (duration !== undefined) { + localVarQueryParameter['duration'] = duration; + } + + if (nBins !== undefined) { + localVarQueryParameter['n_bins'] = nBins; + } + + if (minBinSize !== undefined) { + localVarQueryParameter['min_bin_size'] = minBinSize; + } + + if (splitBy !== undefined) { + localVarQueryParameter['split_by'] = splitBy; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Same as the StarwallOfferWall, but the buckets include contents, no buckets are returned if the user is blocked, and each bucket includes a `is_recontact` key. + * @summary Starwall Plus Block Recontact Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + starwallPlusBlockRecontactOfferwallProductIdOfferwall630db2a4Get: async (productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling starwallPlusBlockRecontactOfferwallProductIdOfferwall630db2a4Get.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling starwallPlusBlockRecontactOfferwallProductIdOfferwall630db2a4Get.'); + } + const localVarPath = `/{product_id}/offerwall/630db2a4/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (ip !== undefined) { + localVarQueryParameter['ip'] = ip; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languages !== undefined) { + localVarQueryParameter['languages'] = languages; + } + + if (behavior !== undefined) { + localVarQueryParameter['behavior'] = behavior; + } + + if (minPayout !== undefined) { + localVarQueryParameter['min_payout'] = minPayout; + } + + if (duration !== undefined) { + localVarQueryParameter['duration'] = duration; + } + + if (nBins !== undefined) { + localVarQueryParameter['n_bins'] = nBins; + } + + if (minBinSize !== undefined) { + localVarQueryParameter['min_bin_size'] = minBinSize; + } + + if (splitBy !== undefined) { + localVarQueryParameter['split_by'] = splitBy; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Same as the StarwallOfferWall, but the buckets include contents. + * @summary Starwall Plus Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + starwallPlusOfferwallProductIdOfferwall5481f322Get: async (productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling starwallPlusOfferwallProductIdOfferwall5481f322Get.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling starwallPlusOfferwallProductIdOfferwall5481f322Get.'); + } + const localVarPath = `/{product_id}/offerwall/5481f322/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (ip !== undefined) { + localVarQueryParameter['ip'] = ip; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languages !== undefined) { + localVarQueryParameter['languages'] = languages; + } + + if (behavior !== undefined) { + localVarQueryParameter['behavior'] = behavior; + } + + if (minPayout !== undefined) { + localVarQueryParameter['min_payout'] = minPayout; + } + + if (duration !== undefined) { + localVarQueryParameter['duration'] = duration; + } + + if (nBins !== undefined) { + localVarQueryParameter['n_bins'] = nBins; + } + + if (minBinSize !== undefined) { + localVarQueryParameter['min_bin_size'] = minBinSize; + } + + if (splitBy !== undefined) { + localVarQueryParameter['split_by'] = splitBy; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Returns an offerwall with buckets that are clustered by the `split_by` argument using KMeans clustering. + * @summary Topn Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + topNOfferwallProductIdOfferwall45b7228a7Get: async (productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling topNOfferwallProductIdOfferwall45b7228a7Get.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling topNOfferwallProductIdOfferwall45b7228a7Get.'); + } + const localVarPath = `/{product_id}/offerwall/45b7228a7/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (ip !== undefined) { + localVarQueryParameter['ip'] = ip; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languages !== undefined) { + localVarQueryParameter['languages'] = languages; + } + + if (behavior !== undefined) { + localVarQueryParameter['behavior'] = behavior; + } + + if (minPayout !== undefined) { + localVarQueryParameter['min_payout'] = minPayout; + } + + if (duration !== undefined) { + localVarQueryParameter['duration'] = duration; + } + + if (nBins !== undefined) { + localVarQueryParameter['n_bins'] = nBins; + } + + if (minBinSize !== undefined) { + localVarQueryParameter['min_bin_size'] = minBinSize; + } + + if (splitBy !== undefined) { + localVarQueryParameter['split_by'] = splitBy; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Same as the TopNOfferWall, but the buckets include contents and no buckets are returned if the user is blocked. + * @summary Topn Plus Block Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + topNPlusBlockOfferwallProductIdOfferwallD48cce47Get: async (productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling topNPlusBlockOfferwallProductIdOfferwallD48cce47Get.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling topNPlusBlockOfferwallProductIdOfferwallD48cce47Get.'); + } + const localVarPath = `/{product_id}/offerwall/d48cce47/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (ip !== undefined) { + localVarQueryParameter['ip'] = ip; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languages !== undefined) { + localVarQueryParameter['languages'] = languages; + } + + if (behavior !== undefined) { + localVarQueryParameter['behavior'] = behavior; + } + + if (minPayout !== undefined) { + localVarQueryParameter['min_payout'] = minPayout; + } + + if (duration !== undefined) { + localVarQueryParameter['duration'] = duration; + } + + if (nBins !== undefined) { + localVarQueryParameter['n_bins'] = nBins; + } + + if (minBinSize !== undefined) { + localVarQueryParameter['min_bin_size'] = minBinSize; + } + + if (splitBy !== undefined) { + localVarQueryParameter['split_by'] = splitBy; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Same as the TopNOfferWall, but the buckets include contents, no buckets are returned if the user is blocked, and each bucket includes a `is_recontact` key. + * @summary Topn Plus Block Recontact Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + topNPlusBlockRecontactOfferwallProductIdOfferwall1e5f0af8Get: async (productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling topNPlusBlockRecontactOfferwallProductIdOfferwall1e5f0af8Get.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling topNPlusBlockRecontactOfferwallProductIdOfferwall1e5f0af8Get.'); + } + const localVarPath = `/{product_id}/offerwall/1e5f0af8/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (ip !== undefined) { + localVarQueryParameter['ip'] = ip; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languages !== undefined) { + localVarQueryParameter['languages'] = languages; + } + + if (behavior !== undefined) { + localVarQueryParameter['behavior'] = behavior; + } + + if (minPayout !== undefined) { + localVarQueryParameter['min_payout'] = minPayout; + } + + if (duration !== undefined) { + localVarQueryParameter['duration'] = duration; + } + + if (nBins !== undefined) { + localVarQueryParameter['n_bins'] = nBins; + } + + if (minBinSize !== undefined) { + localVarQueryParameter['min_bin_size'] = minBinSize; + } + + if (splitBy !== undefined) { + localVarQueryParameter['split_by'] = splitBy; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Same as the TopNOfferWall, but the buckets include contents. + * @summary Topn Plus Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + topNPlusOfferwallProductIdOfferwallB145b803Get: async (productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling topNPlusOfferwallProductIdOfferwallB145b803Get.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling topNPlusOfferwallProductIdOfferwallB145b803Get.'); + } + const localVarPath = `/{product_id}/offerwall/b145b803/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (ip !== undefined) { + localVarQueryParameter['ip'] = ip; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languages !== undefined) { + localVarQueryParameter['languages'] = languages; + } + + if (behavior !== undefined) { + localVarQueryParameter['behavior'] = behavior; + } + + if (minPayout !== undefined) { + localVarQueryParameter['min_payout'] = minPayout; + } + + if (duration !== undefined) { + localVarQueryParameter['duration'] = duration; + } + + if (nBins !== undefined) { + localVarQueryParameter['n_bins'] = nBins; + } + + if (minBinSize !== undefined) { + localVarQueryParameter['min_bin_size'] = minBinSize; + } + + if (splitBy !== undefined) { + localVarQueryParameter['split_by'] = splitBy; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Each bucket has only 1 single task, and only basic info is returned about each bucket. + * @summary Wxet Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + wXETOfferwallProductIdOfferwall55a4e1a9Get: async (productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling wXETOfferwallProductIdOfferwall55a4e1a9Get.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling wXETOfferwallProductIdOfferwall55a4e1a9Get.'); + } + const localVarPath = `/{product_id}/offerwall/55a4e1a9/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (ip !== undefined) { + localVarQueryParameter['ip'] = ip; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languages !== undefined) { + localVarQueryParameter['languages'] = languages; + } + + if (behavior !== undefined) { + localVarQueryParameter['behavior'] = behavior; + } + + if (minPayout !== undefined) { + localVarQueryParameter['min_payout'] = minPayout; + } + + if (duration !== undefined) { + localVarQueryParameter['duration'] = duration; + } + + if (nBins !== undefined) { + localVarQueryParameter['n_bins'] = nBins; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * OfferwallApi - functional programming interface + * @export + */ +export const OfferwallApiFp = function(configuration?: Configuration) { + return { + /** + * Returns buckets grouped by marketplace, one per marketplace, with the tasks ordered by quality. + * @summary Marketplace Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async marketplaceOfferwallProductIdOfferwall5fa23085Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, minBinSize?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<MarketplaceOfferwallResponse>>> { + const localVarAxiosArgs = await OfferwallApiAxiosParamCreator(configuration).marketplaceOfferwallProductIdOfferwall5fa23085Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, minBinSize, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * This is a custom endpoint for a softpair-style offerwall that allows you to update profiling answers and then immediately get back the updated offerwall + * @summary Offerwall Softpair Post + * @param {BodyOfferwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost} body + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} offerwallId The offerwall ID the user is interacting with + * @param {any} sessionId A session id (uuid4.hex) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async offerwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost(body: BodyOfferwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost, bpuid: any, productId: any, offerwallId: any, sessionId: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<SoftPairOfferwallResponse>>> { + const localVarAxiosArgs = await OfferwallApiAxiosParamCreator(configuration).offerwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost(body, bpuid, productId, offerwallId, sessionId, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * This offerwall contains tasks for which the user has a conditional eligibility. The questions that a user must answer to determine the eligibility are included within each bucket. Additionally, the question definitions are included for convenience. + * @summary Offerwall Softpair + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [maxOptions] Max number of options an allowed question can have (allowed to be asked) + * @param {any} [maxQuestions] Max number of missing questions on a single bin + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async offerwallSoftpairProductIdOfferwall37d1da64Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, maxOptions?: any, maxQuestions?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<SoftPairOfferwallResponse>>> { + const localVarAxiosArgs = await OfferwallApiAxiosParamCreator(configuration).offerwallSoftpairProductIdOfferwall37d1da64Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, maxOptions, maxQuestions, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Each bucket has only 1 single task, and only basic info is returned about each bucket. + * @summary One Shot Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [sources] Restrict tasks to those from these marketplaces only. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async oneShotOfferwallProductIdOfferwall6f27b1aeGet(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, sources?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<OneShotOfferwallResponse>>> { + const localVarAxiosArgs = await OfferwallApiAxiosParamCreator(configuration).oneShotOfferwallProductIdOfferwall6f27b1aeGet(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, sources, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Only returns a single bucket with the top scoring tasks. + * @summary Single Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async singleOfferwallProductIdOfferwall5fl8bpv5Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, minBinSize?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<SingleEntryOfferWallResponse>>> { + const localVarAxiosArgs = await OfferwallApiAxiosParamCreator(configuration).singleOfferwallProductIdOfferwall5fl8bpv5Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, minBinSize, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Returns an offerwall with buckets that are clustered by setting as seeds the highest scoring surveys for each bin, then the rest are distributed according to their Euclidean distance using the bucket's features. + * @summary Starwall Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async starwallOfferwallProductIdOfferwallB59a2d2bGet(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<StarwallOfferWallResponse>>> { + const localVarAxiosArgs = await OfferwallApiAxiosParamCreator(configuration).starwallOfferwallProductIdOfferwallB59a2d2bGet(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Same as the StarwallOfferWall, but the buckets include contents and no buckets are returned if the user is blocked. + * @summary Starwall Plus Block Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async starwallPlusBlockOfferwallProductIdOfferwall7fa1b3f4Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<StarwallPlusBlockOfferWallResponse>>> { + const localVarAxiosArgs = await OfferwallApiAxiosParamCreator(configuration).starwallPlusBlockOfferwallProductIdOfferwall7fa1b3f4Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Same as the StarwallOfferWall, but the buckets include contents, no buckets are returned if the user is blocked, and each bucket includes a `is_recontact` key. + * @summary Starwall Plus Block Recontact Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async starwallPlusBlockRecontactOfferwallProductIdOfferwall630db2a4Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<StarwallPlusBlockRecontactOfferWallResponse>>> { + const localVarAxiosArgs = await OfferwallApiAxiosParamCreator(configuration).starwallPlusBlockRecontactOfferwallProductIdOfferwall630db2a4Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Same as the StarwallOfferWall, but the buckets include contents. + * @summary Starwall Plus Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async starwallPlusOfferwallProductIdOfferwall5481f322Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<StarwallPlusOfferWallResponse>>> { + const localVarAxiosArgs = await OfferwallApiAxiosParamCreator(configuration).starwallPlusOfferwallProductIdOfferwall5481f322Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Returns an offerwall with buckets that are clustered by the `split_by` argument using KMeans clustering. + * @summary Topn Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async topNOfferwallProductIdOfferwall45b7228a7Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<TopNOfferWallResponse>>> { + const localVarAxiosArgs = await OfferwallApiAxiosParamCreator(configuration).topNOfferwallProductIdOfferwall45b7228a7Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Same as the TopNOfferWall, but the buckets include contents and no buckets are returned if the user is blocked. + * @summary Topn Plus Block Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async topNPlusBlockOfferwallProductIdOfferwallD48cce47Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<TopNPlusBlockOfferWallResponse>>> { + const localVarAxiosArgs = await OfferwallApiAxiosParamCreator(configuration).topNPlusBlockOfferwallProductIdOfferwallD48cce47Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Same as the TopNOfferWall, but the buckets include contents, no buckets are returned if the user is blocked, and each bucket includes a `is_recontact` key. + * @summary Topn Plus Block Recontact Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async topNPlusBlockRecontactOfferwallProductIdOfferwall1e5f0af8Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<TopNPlusBlockRecontactOfferWallResponse>>> { + const localVarAxiosArgs = await OfferwallApiAxiosParamCreator(configuration).topNPlusBlockRecontactOfferwallProductIdOfferwall1e5f0af8Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Same as the TopNOfferWall, but the buckets include contents. + * @summary Topn Plus Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async topNPlusOfferwallProductIdOfferwallB145b803Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<TopNPlusOfferWallResponse>>> { + const localVarAxiosArgs = await OfferwallApiAxiosParamCreator(configuration).topNPlusOfferwallProductIdOfferwallB145b803Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Each bucket has only 1 single task, and only basic info is returned about each bucket. + * @summary Wxet Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async wXETOfferwallProductIdOfferwall55a4e1a9Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<WXETOfferwallResponse>>> { + const localVarAxiosArgs = await OfferwallApiAxiosParamCreator(configuration).wXETOfferwallProductIdOfferwall55a4e1a9Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * OfferwallApi - factory interface + * @export + */ +export const OfferwallApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + return { + /** + * Returns buckets grouped by marketplace, one per marketplace, with the tasks ordered by quality. + * @summary Marketplace Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async marketplaceOfferwallProductIdOfferwall5fa23085Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, minBinSize?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<MarketplaceOfferwallResponse>> { + return OfferwallApiFp(configuration).marketplaceOfferwallProductIdOfferwall5fa23085Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, minBinSize, options).then((request) => request(axios, basePath)); + }, + /** + * This is a custom endpoint for a softpair-style offerwall that allows you to update profiling answers and then immediately get back the updated offerwall + * @summary Offerwall Softpair Post + * @param {BodyOfferwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost} body + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} offerwallId The offerwall ID the user is interacting with + * @param {any} sessionId A session id (uuid4.hex) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async offerwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost(body: BodyOfferwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost, bpuid: any, productId: any, offerwallId: any, sessionId: any, options?: AxiosRequestConfig): Promise<AxiosResponse<SoftPairOfferwallResponse>> { + return OfferwallApiFp(configuration).offerwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost(body, bpuid, productId, offerwallId, sessionId, options).then((request) => request(axios, basePath)); + }, + /** + * This offerwall contains tasks for which the user has a conditional eligibility. The questions that a user must answer to determine the eligibility are included within each bucket. Additionally, the question definitions are included for convenience. + * @summary Offerwall Softpair + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [maxOptions] Max number of options an allowed question can have (allowed to be asked) + * @param {any} [maxQuestions] Max number of missing questions on a single bin + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async offerwallSoftpairProductIdOfferwall37d1da64Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, maxOptions?: any, maxQuestions?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<SoftPairOfferwallResponse>> { + return OfferwallApiFp(configuration).offerwallSoftpairProductIdOfferwall37d1da64Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, maxOptions, maxQuestions, options).then((request) => request(axios, basePath)); + }, + /** + * Each bucket has only 1 single task, and only basic info is returned about each bucket. + * @summary One Shot Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [sources] Restrict tasks to those from these marketplaces only. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async oneShotOfferwallProductIdOfferwall6f27b1aeGet(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, sources?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<OneShotOfferwallResponse>> { + return OfferwallApiFp(configuration).oneShotOfferwallProductIdOfferwall6f27b1aeGet(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, sources, options).then((request) => request(axios, basePath)); + }, + /** + * Only returns a single bucket with the top scoring tasks. + * @summary Single Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async singleOfferwallProductIdOfferwall5fl8bpv5Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, minBinSize?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<SingleEntryOfferWallResponse>> { + return OfferwallApiFp(configuration).singleOfferwallProductIdOfferwall5fl8bpv5Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, minBinSize, options).then((request) => request(axios, basePath)); + }, + /** + * Returns an offerwall with buckets that are clustered by setting as seeds the highest scoring surveys for each bin, then the rest are distributed according to their Euclidean distance using the bucket's features. + * @summary Starwall Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async starwallOfferwallProductIdOfferwallB59a2d2bGet(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<StarwallOfferWallResponse>> { + return OfferwallApiFp(configuration).starwallOfferwallProductIdOfferwallB59a2d2bGet(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(axios, basePath)); + }, + /** + * Same as the StarwallOfferWall, but the buckets include contents and no buckets are returned if the user is blocked. + * @summary Starwall Plus Block Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async starwallPlusBlockOfferwallProductIdOfferwall7fa1b3f4Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<StarwallPlusBlockOfferWallResponse>> { + return OfferwallApiFp(configuration).starwallPlusBlockOfferwallProductIdOfferwall7fa1b3f4Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(axios, basePath)); + }, + /** + * Same as the StarwallOfferWall, but the buckets include contents, no buckets are returned if the user is blocked, and each bucket includes a `is_recontact` key. + * @summary Starwall Plus Block Recontact Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async starwallPlusBlockRecontactOfferwallProductIdOfferwall630db2a4Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<StarwallPlusBlockRecontactOfferWallResponse>> { + return OfferwallApiFp(configuration).starwallPlusBlockRecontactOfferwallProductIdOfferwall630db2a4Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(axios, basePath)); + }, + /** + * Same as the StarwallOfferWall, but the buckets include contents. + * @summary Starwall Plus Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async starwallPlusOfferwallProductIdOfferwall5481f322Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<StarwallPlusOfferWallResponse>> { + return OfferwallApiFp(configuration).starwallPlusOfferwallProductIdOfferwall5481f322Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(axios, basePath)); + }, + /** + * Returns an offerwall with buckets that are clustered by the `split_by` argument using KMeans clustering. + * @summary Topn Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async topNOfferwallProductIdOfferwall45b7228a7Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<TopNOfferWallResponse>> { + return OfferwallApiFp(configuration).topNOfferwallProductIdOfferwall45b7228a7Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(axios, basePath)); + }, + /** + * Same as the TopNOfferWall, but the buckets include contents and no buckets are returned if the user is blocked. + * @summary Topn Plus Block Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async topNPlusBlockOfferwallProductIdOfferwallD48cce47Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<TopNPlusBlockOfferWallResponse>> { + return OfferwallApiFp(configuration).topNPlusBlockOfferwallProductIdOfferwallD48cce47Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(axios, basePath)); + }, + /** + * Same as the TopNOfferWall, but the buckets include contents, no buckets are returned if the user is blocked, and each bucket includes a `is_recontact` key. + * @summary Topn Plus Block Recontact Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async topNPlusBlockRecontactOfferwallProductIdOfferwall1e5f0af8Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<TopNPlusBlockRecontactOfferWallResponse>> { + return OfferwallApiFp(configuration).topNPlusBlockRecontactOfferwallProductIdOfferwall1e5f0af8Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(axios, basePath)); + }, + /** + * Same as the TopNOfferWall, but the buckets include contents. + * @summary Topn Plus Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async topNPlusOfferwallProductIdOfferwallB145b803Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<TopNPlusOfferWallResponse>> { + return OfferwallApiFp(configuration).topNPlusOfferwallProductIdOfferwallB145b803Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(axios, basePath)); + }, + /** + * Each bucket has only 1 single task, and only basic info is returned about each bucket. + * @summary Wxet Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async wXETOfferwallProductIdOfferwall55a4e1a9Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<WXETOfferwallResponse>> { + return OfferwallApiFp(configuration).wXETOfferwallProductIdOfferwall55a4e1a9Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * OfferwallApi - object-oriented interface + * @export + * @class OfferwallApi + * @extends {BaseAPI} + */ +export class OfferwallApi extends BaseAPI { + /** + * Returns buckets grouped by marketplace, one per marketplace, with the tasks ordered by quality. + * @summary Marketplace Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OfferwallApi + */ + public async marketplaceOfferwallProductIdOfferwall5fa23085Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, minBinSize?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<MarketplaceOfferwallResponse>> { + return OfferwallApiFp(this.configuration).marketplaceOfferwallProductIdOfferwall5fa23085Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, minBinSize, options).then((request) => request(this.axios, this.basePath)); + } + /** + * This is a custom endpoint for a softpair-style offerwall that allows you to update profiling answers and then immediately get back the updated offerwall + * @summary Offerwall Softpair Post + * @param {BodyOfferwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost} body + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} offerwallId The offerwall ID the user is interacting with + * @param {any} sessionId A session id (uuid4.hex) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OfferwallApi + */ + public async offerwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost(body: BodyOfferwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost, bpuid: any, productId: any, offerwallId: any, sessionId: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<SoftPairOfferwallResponse>> { + return OfferwallApiFp(this.configuration).offerwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost(body, bpuid, productId, offerwallId, sessionId, options).then((request) => request(this.axios, this.basePath)); + } + /** + * This offerwall contains tasks for which the user has a conditional eligibility. The questions that a user must answer to determine the eligibility are included within each bucket. Additionally, the question definitions are included for convenience. + * @summary Offerwall Softpair + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [maxOptions] Max number of options an allowed question can have (allowed to be asked) + * @param {any} [maxQuestions] Max number of missing questions on a single bin + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OfferwallApi + */ + public async offerwallSoftpairProductIdOfferwall37d1da64Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, maxOptions?: any, maxQuestions?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<SoftPairOfferwallResponse>> { + return OfferwallApiFp(this.configuration).offerwallSoftpairProductIdOfferwall37d1da64Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, maxOptions, maxQuestions, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Each bucket has only 1 single task, and only basic info is returned about each bucket. + * @summary One Shot Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [sources] Restrict tasks to those from these marketplaces only. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OfferwallApi + */ + public async oneShotOfferwallProductIdOfferwall6f27b1aeGet(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, sources?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<OneShotOfferwallResponse>> { + return OfferwallApiFp(this.configuration).oneShotOfferwallProductIdOfferwall6f27b1aeGet(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, sources, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Only returns a single bucket with the top scoring tasks. + * @summary Single Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OfferwallApi + */ + public async singleOfferwallProductIdOfferwall5fl8bpv5Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, minBinSize?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<SingleEntryOfferWallResponse>> { + return OfferwallApiFp(this.configuration).singleOfferwallProductIdOfferwall5fl8bpv5Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, minBinSize, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Returns an offerwall with buckets that are clustered by setting as seeds the highest scoring surveys for each bin, then the rest are distributed according to their Euclidean distance using the bucket's features. + * @summary Starwall Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OfferwallApi + */ + public async starwallOfferwallProductIdOfferwallB59a2d2bGet(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<StarwallOfferWallResponse>> { + return OfferwallApiFp(this.configuration).starwallOfferwallProductIdOfferwallB59a2d2bGet(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Same as the StarwallOfferWall, but the buckets include contents and no buckets are returned if the user is blocked. + * @summary Starwall Plus Block Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OfferwallApi + */ + public async starwallPlusBlockOfferwallProductIdOfferwall7fa1b3f4Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<StarwallPlusBlockOfferWallResponse>> { + return OfferwallApiFp(this.configuration).starwallPlusBlockOfferwallProductIdOfferwall7fa1b3f4Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Same as the StarwallOfferWall, but the buckets include contents, no buckets are returned if the user is blocked, and each bucket includes a `is_recontact` key. + * @summary Starwall Plus Block Recontact Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OfferwallApi + */ + public async starwallPlusBlockRecontactOfferwallProductIdOfferwall630db2a4Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<StarwallPlusBlockRecontactOfferWallResponse>> { + return OfferwallApiFp(this.configuration).starwallPlusBlockRecontactOfferwallProductIdOfferwall630db2a4Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Same as the StarwallOfferWall, but the buckets include contents. + * @summary Starwall Plus Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OfferwallApi + */ + public async starwallPlusOfferwallProductIdOfferwall5481f322Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<StarwallPlusOfferWallResponse>> { + return OfferwallApiFp(this.configuration).starwallPlusOfferwallProductIdOfferwall5481f322Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Returns an offerwall with buckets that are clustered by the `split_by` argument using KMeans clustering. + * @summary Topn Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OfferwallApi + */ + public async topNOfferwallProductIdOfferwall45b7228a7Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<TopNOfferWallResponse>> { + return OfferwallApiFp(this.configuration).topNOfferwallProductIdOfferwall45b7228a7Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Same as the TopNOfferWall, but the buckets include contents and no buckets are returned if the user is blocked. + * @summary Topn Plus Block Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OfferwallApi + */ + public async topNPlusBlockOfferwallProductIdOfferwallD48cce47Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<TopNPlusBlockOfferWallResponse>> { + return OfferwallApiFp(this.configuration).topNPlusBlockOfferwallProductIdOfferwallD48cce47Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Same as the TopNOfferWall, but the buckets include contents, no buckets are returned if the user is blocked, and each bucket includes a `is_recontact` key. + * @summary Topn Plus Block Recontact Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OfferwallApi + */ + public async topNPlusBlockRecontactOfferwallProductIdOfferwall1e5f0af8Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<TopNPlusBlockRecontactOfferWallResponse>> { + return OfferwallApiFp(this.configuration).topNPlusBlockRecontactOfferwallProductIdOfferwall1e5f0af8Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Same as the TopNOfferWall, but the buckets include contents. + * @summary Topn Plus Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {any} [minBinSize] Minimum number of tasks that need to be in a bucket + * @param {any} [splitBy] Cluster tasks by payout or duration + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OfferwallApi + */ + public async topNPlusOfferwallProductIdOfferwallB145b803Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, minBinSize?: any, splitBy?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<TopNPlusOfferWallResponse>> { + return OfferwallApiFp(this.configuration).topNPlusOfferwallProductIdOfferwallB145b803Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, minBinSize, splitBy, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Each bucket has only 1 single task, and only basic info is returned about each bucket. + * @summary Wxet Offerwall + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languages] Respondent's desired languages (ISO 639-2/B, lowercase) + * @param {any} [behavior] Allows using custom scoring functions. Please discuss directly with GRL. + * @param {any} [minPayout] Decimal representation of the minimum amount of USD that any of the tasks will pay + * @param {any} [duration] Maximum length of desired task (in seconds). + * @param {any} [nBins] Number of bins requested in the offerwall. If n_bins=1 there is no grouping and you get all duration + payout metrics on across all (as shown by the availability_count). n_bins=0 will return back an empty bucket array, however, the availability_count will still show the total opportunities available for that bpuid + passed in parameter settings. n_bins=∞ (or any positive integer) will return back the total number of bins capable of being uniquely split. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof OfferwallApi + */ + public async wXETOfferwallProductIdOfferwall55a4e1a9Get(productId: any, bpuid: any, ip?: any, countryIso?: any, languages?: any, behavior?: any, minPayout?: any, duration?: any, nBins?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<WXETOfferwallResponse>> { + return OfferwallApiFp(this.configuration).wXETOfferwallProductIdOfferwall55a4e1a9Get(productId, bpuid, ip, countryIso, languages, behavior, minPayout, duration, nBins, options).then((request) => request(this.axios, this.basePath)); + } +} diff --git a/src/api/apis/profiling-questions-api.ts b/src/api/apis/profiling-questions-api.ts new file mode 100644 index 0000000..cdcdb85 --- /dev/null +++ b/src/api/apis/profiling-questions-api.ts @@ -0,0 +1,504 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import globalAxios, { AxiosResponse, AxiosInstance, AxiosRequestConfig } from 'axios'; +import { Configuration } from '../configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; +import { BodySubmitProfilingQuestionsProductIdProfilingQuestionsPost } from '../models'; +import { HTTPValidationError } from '../models'; +import { ProfilingInfoResponse } from '../models'; +import { StatusResponse } from '../models'; +import { UpkQuestionResponse } from '../models'; +import { UserInfoResponse } from '../models'; +/** + * ProfilingQuestionsApi - axios parameter creator + * @export + */ +export const ProfilingQuestionsApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Gets a list of profiling questions to ask this user. These questions are, as of right now, unanswered. Once a question is answered, it (and any other question whose answer is inferred from other answers) is removed from the list. The questions returned are ordered by importance (the key task_score) in descending order. + * @summary Get Profiling Questions + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languageIso] Respondent's desired language (ISO 639-2/B, lowercase) + * @param {any} [limit] Number of questions to return. Questions are ordered, so, selects the N most important. If no limit is passed, then the number of questions returned is dynamically calculated by the questions' importance. + * @param {any} [isGrs] If it's the GRS system. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProfilingQuestionsProductIdProfilingQuestionsGet: async (productId: any, bpuid: any, ip?: any, countryIso?: any, languageIso?: any, limit?: any, isGrs?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling getProfilingQuestionsProductIdProfilingQuestionsGet.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling getProfilingQuestionsProductIdProfilingQuestionsGet.'); + } + const localVarPath = `/{product_id}/profiling-questions/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (ip !== undefined) { + localVarQueryParameter['ip'] = ip; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languageIso !== undefined) { + localVarQueryParameter['language_iso'] = languageIso; + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit; + } + + if (isGrs !== undefined) { + localVarQueryParameter['is_grs'] = isGrs; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Get UPK Ontology (list of properties, property info, and allowed values) + * @summary Profiling Info + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} countryIso Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languageIso] Respondent's desired language (ISO 639-2/B, lowercase) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + profilingInfoProductIdProfilingInfoGet: async (productId: any, countryIso: any, languageIso?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling profilingInfoProductIdProfilingInfoGet.'); + } + // verify required parameter 'countryIso' is not null or undefined + if (countryIso === null || countryIso === undefined) { + throw new RequiredError('countryIso','Required parameter countryIso was null or undefined when calling profilingInfoProductIdProfilingInfoGet.'); + } + const localVarPath = `/{product_id}/profiling-info/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languageIso !== undefined) { + localVarQueryParameter['language_iso'] = languageIso; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Send the answers to one or more of these questions for a user. A question is uniquely specified by the question_id key. The answer is: the choice_id if the question_type is \"MC\" the actual entered text if the question_type is \"TE\" + * @summary Submit Profiling Questions + * @param {BodySubmitProfilingQuestionsProductIdProfilingQuestionsPost} body + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} [sessionId] The unique identifier for a session in which these questions were asked. Must be a valid UUID. Optional. + * @param {any} [async] For internal use. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + submitProfilingQuestionsProductIdProfilingQuestionsPost: async (body: BodySubmitProfilingQuestionsProductIdProfilingQuestionsPost, bpuid: any, productId: any, sessionId?: any, async?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling submitProfilingQuestionsProductIdProfilingQuestionsPost.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling submitProfilingQuestionsProductIdProfilingQuestionsPost.'); + } + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling submitProfilingQuestionsProductIdProfilingQuestionsPost.'); + } + const localVarPath = `/{product_id}/profiling-questions/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (sessionId !== undefined) { + localVarQueryParameter['session_id'] = sessionId; + } + + if (async !== undefined) { + localVarQueryParameter['async'] = async; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary User Profile + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} countryIso Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languageIso] Respondent's desired language (ISO 639-2/B, lowercase) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + userProfileProductIdUserProfileGet: async (productId: any, bpuid: any, countryIso: any, languageIso?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling userProfileProductIdUserProfileGet.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling userProfileProductIdUserProfileGet.'); + } + // verify required parameter 'countryIso' is not null or undefined + if (countryIso === null || countryIso === undefined) { + throw new RequiredError('countryIso','Required parameter countryIso was null or undefined when calling userProfileProductIdUserProfileGet.'); + } + const localVarPath = `/{product_id}/user-profile/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (countryIso !== undefined) { + localVarQueryParameter['country_iso'] = countryIso; + } + + if (languageIso !== undefined) { + localVarQueryParameter['language_iso'] = languageIso; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * ProfilingQuestionsApi - functional programming interface + * @export + */ +export const ProfilingQuestionsApiFp = function(configuration?: Configuration) { + return { + /** + * Gets a list of profiling questions to ask this user. These questions are, as of right now, unanswered. Once a question is answered, it (and any other question whose answer is inferred from other answers) is removed from the list. The questions returned are ordered by importance (the key task_score) in descending order. + * @summary Get Profiling Questions + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languageIso] Respondent's desired language (ISO 639-2/B, lowercase) + * @param {any} [limit] Number of questions to return. Questions are ordered, so, selects the N most important. If no limit is passed, then the number of questions returned is dynamically calculated by the questions' importance. + * @param {any} [isGrs] If it's the GRS system. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getProfilingQuestionsProductIdProfilingQuestionsGet(productId: any, bpuid: any, ip?: any, countryIso?: any, languageIso?: any, limit?: any, isGrs?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<UpkQuestionResponse>>> { + const localVarAxiosArgs = await ProfilingQuestionsApiAxiosParamCreator(configuration).getProfilingQuestionsProductIdProfilingQuestionsGet(productId, bpuid, ip, countryIso, languageIso, limit, isGrs, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Get UPK Ontology (list of properties, property info, and allowed values) + * @summary Profiling Info + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} countryIso Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languageIso] Respondent's desired language (ISO 639-2/B, lowercase) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async profilingInfoProductIdProfilingInfoGet(productId: any, countryIso: any, languageIso?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ProfilingInfoResponse>>> { + const localVarAxiosArgs = await ProfilingQuestionsApiAxiosParamCreator(configuration).profilingInfoProductIdProfilingInfoGet(productId, countryIso, languageIso, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Send the answers to one or more of these questions for a user. A question is uniquely specified by the question_id key. The answer is: the choice_id if the question_type is \"MC\" the actual entered text if the question_type is \"TE\" + * @summary Submit Profiling Questions + * @param {BodySubmitProfilingQuestionsProductIdProfilingQuestionsPost} body + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} [sessionId] The unique identifier for a session in which these questions were asked. Must be a valid UUID. Optional. + * @param {any} [async] For internal use. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async submitProfilingQuestionsProductIdProfilingQuestionsPost(body: BodySubmitProfilingQuestionsProductIdProfilingQuestionsPost, bpuid: any, productId: any, sessionId?: any, async?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<StatusResponse>>> { + const localVarAxiosArgs = await ProfilingQuestionsApiAxiosParamCreator(configuration).submitProfilingQuestionsProductIdProfilingQuestionsPost(body, bpuid, productId, sessionId, async, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary User Profile + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} countryIso Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languageIso] Respondent's desired language (ISO 639-2/B, lowercase) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async userProfileProductIdUserProfileGet(productId: any, bpuid: any, countryIso: any, languageIso?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<UserInfoResponse>>> { + const localVarAxiosArgs = await ProfilingQuestionsApiAxiosParamCreator(configuration).userProfileProductIdUserProfileGet(productId, bpuid, countryIso, languageIso, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * ProfilingQuestionsApi - factory interface + * @export + */ +export const ProfilingQuestionsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + return { + /** + * Gets a list of profiling questions to ask this user. These questions are, as of right now, unanswered. Once a question is answered, it (and any other question whose answer is inferred from other answers) is removed from the list. The questions returned are ordered by importance (the key task_score) in descending order. + * @summary Get Profiling Questions + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languageIso] Respondent's desired language (ISO 639-2/B, lowercase) + * @param {any} [limit] Number of questions to return. Questions are ordered, so, selects the N most important. If no limit is passed, then the number of questions returned is dynamically calculated by the questions' importance. + * @param {any} [isGrs] If it's the GRS system. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getProfilingQuestionsProductIdProfilingQuestionsGet(productId: any, bpuid: any, ip?: any, countryIso?: any, languageIso?: any, limit?: any, isGrs?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<UpkQuestionResponse>> { + return ProfilingQuestionsApiFp(configuration).getProfilingQuestionsProductIdProfilingQuestionsGet(productId, bpuid, ip, countryIso, languageIso, limit, isGrs, options).then((request) => request(axios, basePath)); + }, + /** + * Get UPK Ontology (list of properties, property info, and allowed values) + * @summary Profiling Info + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} countryIso Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languageIso] Respondent's desired language (ISO 639-2/B, lowercase) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async profilingInfoProductIdProfilingInfoGet(productId: any, countryIso: any, languageIso?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<ProfilingInfoResponse>> { + return ProfilingQuestionsApiFp(configuration).profilingInfoProductIdProfilingInfoGet(productId, countryIso, languageIso, options).then((request) => request(axios, basePath)); + }, + /** + * Send the answers to one or more of these questions for a user. A question is uniquely specified by the question_id key. The answer is: the choice_id if the question_type is \"MC\" the actual entered text if the question_type is \"TE\" + * @summary Submit Profiling Questions + * @param {BodySubmitProfilingQuestionsProductIdProfilingQuestionsPost} body + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} [sessionId] The unique identifier for a session in which these questions were asked. Must be a valid UUID. Optional. + * @param {any} [async] For internal use. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async submitProfilingQuestionsProductIdProfilingQuestionsPost(body: BodySubmitProfilingQuestionsProductIdProfilingQuestionsPost, bpuid: any, productId: any, sessionId?: any, async?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<StatusResponse>> { + return ProfilingQuestionsApiFp(configuration).submitProfilingQuestionsProductIdProfilingQuestionsPost(body, bpuid, productId, sessionId, async, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary User Profile + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} countryIso Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languageIso] Respondent's desired language (ISO 639-2/B, lowercase) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async userProfileProductIdUserProfileGet(productId: any, bpuid: any, countryIso: any, languageIso?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<UserInfoResponse>> { + return ProfilingQuestionsApiFp(configuration).userProfileProductIdUserProfileGet(productId, bpuid, countryIso, languageIso, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * ProfilingQuestionsApi - object-oriented interface + * @export + * @class ProfilingQuestionsApi + * @extends {BaseAPI} + */ +export class ProfilingQuestionsApi extends BaseAPI { + /** + * Gets a list of profiling questions to ask this user. These questions are, as of right now, unanswered. Once a question is answered, it (and any other question whose answer is inferred from other answers) is removed from the list. The questions returned are ordered by importance (the key task_score) in descending order. + * @summary Get Profiling Questions + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} [ip] Respondent's IP address (IPv4 or IPv6). Either 'ip' must be provided, or 'country_iso' must be provided if 'ip' is not provided. + * @param {any} [countryIso] Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languageIso] Respondent's desired language (ISO 639-2/B, lowercase) + * @param {any} [limit] Number of questions to return. Questions are ordered, so, selects the N most important. If no limit is passed, then the number of questions returned is dynamically calculated by the questions' importance. + * @param {any} [isGrs] If it's the GRS system. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ProfilingQuestionsApi + */ + public async getProfilingQuestionsProductIdProfilingQuestionsGet(productId: any, bpuid: any, ip?: any, countryIso?: any, languageIso?: any, limit?: any, isGrs?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<UpkQuestionResponse>> { + return ProfilingQuestionsApiFp(this.configuration).getProfilingQuestionsProductIdProfilingQuestionsGet(productId, bpuid, ip, countryIso, languageIso, limit, isGrs, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Get UPK Ontology (list of properties, property info, and allowed values) + * @summary Profiling Info + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} countryIso Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languageIso] Respondent's desired language (ISO 639-2/B, lowercase) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ProfilingQuestionsApi + */ + public async profilingInfoProductIdProfilingInfoGet(productId: any, countryIso: any, languageIso?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<ProfilingInfoResponse>> { + return ProfilingQuestionsApiFp(this.configuration).profilingInfoProductIdProfilingInfoGet(productId, countryIso, languageIso, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Send the answers to one or more of these questions for a user. A question is uniquely specified by the question_id key. The answer is: the choice_id if the question_type is \"MC\" the actual entered text if the question_type is \"TE\" + * @summary Submit Profiling Questions + * @param {BodySubmitProfilingQuestionsProductIdProfilingQuestionsPost} body + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} [sessionId] The unique identifier for a session in which these questions were asked. Must be a valid UUID. Optional. + * @param {any} [async] For internal use. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ProfilingQuestionsApi + */ + public async submitProfilingQuestionsProductIdProfilingQuestionsPost(body: BodySubmitProfilingQuestionsProductIdProfilingQuestionsPost, bpuid: any, productId: any, sessionId?: any, async?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<StatusResponse>> { + return ProfilingQuestionsApiFp(this.configuration).submitProfilingQuestionsProductIdProfilingQuestionsPost(body, bpuid, productId, sessionId, async, options).then((request) => request(this.axios, this.basePath)); + } + /** + * + * @summary User Profile + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {any} countryIso Respondent's country code (ISO 3166-1 alpha-2, lowercase) + * @param {any} [languageIso] Respondent's desired language (ISO 639-2/B, lowercase) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ProfilingQuestionsApi + */ + public async userProfileProductIdUserProfileGet(productId: any, bpuid: any, countryIso: any, languageIso?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<UserInfoResponse>> { + return ProfilingQuestionsApiFp(this.configuration).userProfileProductIdUserProfileGet(productId, bpuid, countryIso, languageIso, options).then((request) => request(this.axios, this.basePath)); + } +} diff --git a/src/api/apis/report-api.ts b/src/api/apis/report-api.ts new file mode 100644 index 0000000..d3f74b8 --- /dev/null +++ b/src/api/apis/report-api.ts @@ -0,0 +1,144 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import globalAxios, { AxiosResponse, AxiosInstance, AxiosRequestConfig } from 'axios'; +import { Configuration } from '../configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; +import { HTTPValidationError } from '../models'; +import { ReportTask } from '../models'; +import { StatusResponse } from '../models'; +/** + * ReportApi - axios parameter creator + * @export + */ +export const ReportApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Send a \"Task Report\" for a respondent's latest started survey, regardless of the survey's outcome. Task Reports cannot be provided for task attempts by tsid, or through any other method, they must be given immediately after the respondent's task attempt. If a latest attempt can't be found, a ReportTaskResponse is still returned. If multiple reasons want to be provided, they should be done at the same time. If multiple reports are given for the same latest started task, the note attribute will be overwritten, while the new unique reasons will be appended to the task attempt. Task Report system contributions by client applications are immediately leveraged to aid yield management strategies. For those reasons, it's important that the respondent submits a Task Report as soon as possible and applications doesn't offload this request for a later time. Task Report timestamps are a critical component of understanding a Task experience for a respondent. For the BP to tell us about a bad survey they want to report The POSTed data looks like: { 'bpuid': '1234', 'reasons': [2], 'notes': \"This survey was the worst!\" } Returns {'status': 'success', 'msg': error_msg} + * @summary Report Task + * @param {ReportTask} body + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTaskProductIdReportPost: async (body: ReportTask, productId: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling reportTaskProductIdReportPost.'); + } + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling reportTaskProductIdReportPost.'); + } + const localVarPath = `/{product_id}/report/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * ReportApi - functional programming interface + * @export + */ +export const ReportApiFp = function(configuration?: Configuration) { + return { + /** + * Send a \"Task Report\" for a respondent's latest started survey, regardless of the survey's outcome. Task Reports cannot be provided for task attempts by tsid, or through any other method, they must be given immediately after the respondent's task attempt. If a latest attempt can't be found, a ReportTaskResponse is still returned. If multiple reasons want to be provided, they should be done at the same time. If multiple reports are given for the same latest started task, the note attribute will be overwritten, while the new unique reasons will be appended to the task attempt. Task Report system contributions by client applications are immediately leveraged to aid yield management strategies. For those reasons, it's important that the respondent submits a Task Report as soon as possible and applications doesn't offload this request for a later time. Task Report timestamps are a critical component of understanding a Task experience for a respondent. For the BP to tell us about a bad survey they want to report The POSTed data looks like: { 'bpuid': '1234', 'reasons': [2], 'notes': \"This survey was the worst!\" } Returns {'status': 'success', 'msg': error_msg} + * @summary Report Task + * @param {ReportTask} body + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async reportTaskProductIdReportPost(body: ReportTask, productId: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<StatusResponse>>> { + const localVarAxiosArgs = await ReportApiAxiosParamCreator(configuration).reportTaskProductIdReportPost(body, productId, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * ReportApi - factory interface + * @export + */ +export const ReportApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + return { + /** + * Send a \"Task Report\" for a respondent's latest started survey, regardless of the survey's outcome. Task Reports cannot be provided for task attempts by tsid, or through any other method, they must be given immediately after the respondent's task attempt. If a latest attempt can't be found, a ReportTaskResponse is still returned. If multiple reasons want to be provided, they should be done at the same time. If multiple reports are given for the same latest started task, the note attribute will be overwritten, while the new unique reasons will be appended to the task attempt. Task Report system contributions by client applications are immediately leveraged to aid yield management strategies. For those reasons, it's important that the respondent submits a Task Report as soon as possible and applications doesn't offload this request for a later time. Task Report timestamps are a critical component of understanding a Task experience for a respondent. For the BP to tell us about a bad survey they want to report The POSTed data looks like: { 'bpuid': '1234', 'reasons': [2], 'notes': \"This survey was the worst!\" } Returns {'status': 'success', 'msg': error_msg} + * @summary Report Task + * @param {ReportTask} body + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async reportTaskProductIdReportPost(body: ReportTask, productId: any, options?: AxiosRequestConfig): Promise<AxiosResponse<StatusResponse>> { + return ReportApiFp(configuration).reportTaskProductIdReportPost(body, productId, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * ReportApi - object-oriented interface + * @export + * @class ReportApi + * @extends {BaseAPI} + */ +export class ReportApi extends BaseAPI { + /** + * Send a \"Task Report\" for a respondent's latest started survey, regardless of the survey's outcome. Task Reports cannot be provided for task attempts by tsid, or through any other method, they must be given immediately after the respondent's task attempt. If a latest attempt can't be found, a ReportTaskResponse is still returned. If multiple reasons want to be provided, they should be done at the same time. If multiple reports are given for the same latest started task, the note attribute will be overwritten, while the new unique reasons will be appended to the task attempt. Task Report system contributions by client applications are immediately leveraged to aid yield management strategies. For those reasons, it's important that the respondent submits a Task Report as soon as possible and applications doesn't offload this request for a later time. Task Report timestamps are a critical component of understanding a Task experience for a respondent. For the BP to tell us about a bad survey they want to report The POSTed data looks like: { 'bpuid': '1234', 'reasons': [2], 'notes': \"This survey was the worst!\" } Returns {'status': 'success', 'msg': error_msg} + * @summary Report Task + * @param {ReportTask} body + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ReportApi + */ + public async reportTaskProductIdReportPost(body: ReportTask, productId: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<StatusResponse>> { + return ReportApiFp(this.configuration).reportTaskProductIdReportPost(body, productId, options).then((request) => request(this.axios, this.basePath)); + } +} diff --git a/src/api/apis/status-api.ts b/src/api/apis/status-api.ts new file mode 100644 index 0000000..2a97ffe --- /dev/null +++ b/src/api/apis/status-api.ts @@ -0,0 +1,274 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import globalAxios, { AxiosResponse, AxiosInstance, AxiosRequestConfig } from 'axios'; +import { Configuration } from '../configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; +import { HTTPValidationError } from '../models'; +import { StatusInfoResponseFail } from '../models'; +import { StatusResponseFailure } from '../models'; +import { TaskStatusResponseOut } from '../models'; +import { TasksStatusResponseOut } from '../models'; +/** + * StatusApi - axios parameter creator + * @export + */ +export const StatusApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Retrieve the status of a session by a specific Task Status ID (`tsid`) that is provided in the redirect. Given a `tsid`, get back the status of the wall event. This endpoint conflates the idea of a wall event and a session, but for these purposes, the status and payout of the last wall event in a session equals the status and payout for the session. + * @summary Get Task Status + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} tsid A unique identifier for the session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTaskStatusProductIdStatusTsidGet: async (productId: any, tsid: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling getTaskStatusProductIdStatusTsidGet.'); + } + // verify required parameter 'tsid' is not null or undefined + if (tsid === null || tsid === undefined) { + throw new RequiredError('tsid','Required parameter tsid was null or undefined when calling getTaskStatusProductIdStatusTsidGet.'); + } + const localVarPath = `/{product_id}/status/{tsid}/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))) + .replace(`{${"tsid"}}`, encodeURIComponent(String(tsid))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary List Task Statuses + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} [bpuid] A unique identifier for each user, which is set by the Supplier. Filters the returned task status to only include those done by this user. + * @param {any} [startedAfter] (unix timestamp) Retrieve sessions which were started after this timestamp. If `NULL`, default is 10 days ago. + * @param {any} [startedBefore] (unix timestamp) Retrieve sessions which were started before this timestamp. If `NULL`, default is now. + * @param {any} [status] Filter for sessions with this status. See Task Status for description of status. + * @param {any} [reconciled] Only retrieve sessions that have been adjusted. If `reconciled` is True, `adjusted_after` is required. + * @param {any} [adjustedAfter] (unix timestamp) Retrieve sessions which were adjusted after this timestamp. + * @param {any} [adjustedBefore] (unix timestamp) Retrieve sessions which were adjusted before this timestamp. Default is now. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listTaskStatusesProductIdStatusGet: async (productId: any, bpuid?: any, startedAfter?: any, startedBefore?: any, status?: any, reconciled?: any, adjustedAfter?: any, adjustedBefore?: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling listTaskStatusesProductIdStatusGet.'); + } + const localVarPath = `/{product_id}/status/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + if (startedAfter !== undefined) { + localVarQueryParameter['started_after'] = startedAfter; + } + + if (startedBefore !== undefined) { + localVarQueryParameter['started_before'] = startedBefore; + } + + if (status !== undefined) { + localVarQueryParameter['status'] = status; + } + + if (reconciled !== undefined) { + localVarQueryParameter['reconciled'] = reconciled; + } + + if (adjustedAfter !== undefined) { + localVarQueryParameter['adjusted_after'] = adjustedAfter; + } + + if (adjustedBefore !== undefined) { + localVarQueryParameter['adjusted_before'] = adjustedBefore; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * StatusApi - functional programming interface + * @export + */ +export const StatusApiFp = function(configuration?: Configuration) { + return { + /** + * Retrieve the status of a session by a specific Task Status ID (`tsid`) that is provided in the redirect. Given a `tsid`, get back the status of the wall event. This endpoint conflates the idea of a wall event and a session, but for these purposes, the status and payout of the last wall event in a session equals the status and payout for the session. + * @summary Get Task Status + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} tsid A unique identifier for the session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getTaskStatusProductIdStatusTsidGet(productId: any, tsid: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<TaskStatusResponseOut>>> { + const localVarAxiosArgs = await StatusApiAxiosParamCreator(configuration).getTaskStatusProductIdStatusTsidGet(productId, tsid, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary List Task Statuses + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} [bpuid] A unique identifier for each user, which is set by the Supplier. Filters the returned task status to only include those done by this user. + * @param {any} [startedAfter] (unix timestamp) Retrieve sessions which were started after this timestamp. If `NULL`, default is 10 days ago. + * @param {any} [startedBefore] (unix timestamp) Retrieve sessions which were started before this timestamp. If `NULL`, default is now. + * @param {any} [status] Filter for sessions with this status. See Task Status for description of status. + * @param {any} [reconciled] Only retrieve sessions that have been adjusted. If `reconciled` is True, `adjusted_after` is required. + * @param {any} [adjustedAfter] (unix timestamp) Retrieve sessions which were adjusted after this timestamp. + * @param {any} [adjustedBefore] (unix timestamp) Retrieve sessions which were adjusted before this timestamp. Default is now. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listTaskStatusesProductIdStatusGet(productId: any, bpuid?: any, startedAfter?: any, startedBefore?: any, status?: any, reconciled?: any, adjustedAfter?: any, adjustedBefore?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<TasksStatusResponseOut>>> { + const localVarAxiosArgs = await StatusApiAxiosParamCreator(configuration).listTaskStatusesProductIdStatusGet(productId, bpuid, startedAfter, startedBefore, status, reconciled, adjustedAfter, adjustedBefore, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * StatusApi - factory interface + * @export + */ +export const StatusApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + return { + /** + * Retrieve the status of a session by a specific Task Status ID (`tsid`) that is provided in the redirect. Given a `tsid`, get back the status of the wall event. This endpoint conflates the idea of a wall event and a session, but for these purposes, the status and payout of the last wall event in a session equals the status and payout for the session. + * @summary Get Task Status + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} tsid A unique identifier for the session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getTaskStatusProductIdStatusTsidGet(productId: any, tsid: any, options?: AxiosRequestConfig): Promise<AxiosResponse<TaskStatusResponseOut>> { + return StatusApiFp(configuration).getTaskStatusProductIdStatusTsidGet(productId, tsid, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary List Task Statuses + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} [bpuid] A unique identifier for each user, which is set by the Supplier. Filters the returned task status to only include those done by this user. + * @param {any} [startedAfter] (unix timestamp) Retrieve sessions which were started after this timestamp. If `NULL`, default is 10 days ago. + * @param {any} [startedBefore] (unix timestamp) Retrieve sessions which were started before this timestamp. If `NULL`, default is now. + * @param {any} [status] Filter for sessions with this status. See Task Status for description of status. + * @param {any} [reconciled] Only retrieve sessions that have been adjusted. If `reconciled` is True, `adjusted_after` is required. + * @param {any} [adjustedAfter] (unix timestamp) Retrieve sessions which were adjusted after this timestamp. + * @param {any} [adjustedBefore] (unix timestamp) Retrieve sessions which were adjusted before this timestamp. Default is now. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listTaskStatusesProductIdStatusGet(productId: any, bpuid?: any, startedAfter?: any, startedBefore?: any, status?: any, reconciled?: any, adjustedAfter?: any, adjustedBefore?: any, options?: AxiosRequestConfig): Promise<AxiosResponse<TasksStatusResponseOut>> { + return StatusApiFp(configuration).listTaskStatusesProductIdStatusGet(productId, bpuid, startedAfter, startedBefore, status, reconciled, adjustedAfter, adjustedBefore, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * StatusApi - object-oriented interface + * @export + * @class StatusApi + * @extends {BaseAPI} + */ +export class StatusApi extends BaseAPI { + /** + * Retrieve the status of a session by a specific Task Status ID (`tsid`) that is provided in the redirect. Given a `tsid`, get back the status of the wall event. This endpoint conflates the idea of a wall event and a session, but for these purposes, the status and payout of the last wall event in a session equals the status and payout for the session. + * @summary Get Task Status + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} tsid A unique identifier for the session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StatusApi + */ + public async getTaskStatusProductIdStatusTsidGet(productId: any, tsid: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<TaskStatusResponseOut>> { + return StatusApiFp(this.configuration).getTaskStatusProductIdStatusTsidGet(productId, tsid, options).then((request) => request(this.axios, this.basePath)); + } + /** + * + * @summary List Task Statuses + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} [bpuid] A unique identifier for each user, which is set by the Supplier. Filters the returned task status to only include those done by this user. + * @param {any} [startedAfter] (unix timestamp) Retrieve sessions which were started after this timestamp. If `NULL`, default is 10 days ago. + * @param {any} [startedBefore] (unix timestamp) Retrieve sessions which were started before this timestamp. If `NULL`, default is now. + * @param {any} [status] Filter for sessions with this status. See Task Status for description of status. + * @param {any} [reconciled] Only retrieve sessions that have been adjusted. If `reconciled` is True, `adjusted_after` is required. + * @param {any} [adjustedAfter] (unix timestamp) Retrieve sessions which were adjusted after this timestamp. + * @param {any} [adjustedBefore] (unix timestamp) Retrieve sessions which were adjusted before this timestamp. Default is now. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StatusApi + */ + public async listTaskStatusesProductIdStatusGet(productId: any, bpuid?: any, startedAfter?: any, startedBefore?: any, status?: any, reconciled?: any, adjustedAfter?: any, adjustedBefore?: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<TasksStatusResponseOut>> { + return StatusApiFp(this.configuration).listTaskStatusesProductIdStatusGet(productId, bpuid, startedAfter, startedBefore, status, reconciled, adjustedAfter, adjustedBefore, options).then((request) => request(this.axios, this.basePath)); + } +} diff --git a/src/api/apis/wallet-api.ts b/src/api/apis/wallet-api.ts new file mode 100644 index 0000000..37a8cee --- /dev/null +++ b/src/api/apis/wallet-api.ts @@ -0,0 +1,774 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import globalAxios, { AxiosResponse, AxiosInstance, AxiosRequestConfig } from 'axios'; +import { Configuration } from '../configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; +import { CashoutMethodForeignValueResponse } from '../models'; +import { CashoutMethodResponse } from '../models'; +import { CashoutMethodsResponse } from '../models'; +import { CashoutRequestResponse } from '../models'; +import { CreateCashoutRequest } from '../models'; +import { HTTPValidationError } from '../models'; +import { StatusResponse } from '../models'; +import { UserTransactionHistoryResponse } from '../models'; +import { UserWalletBalanceResponse } from '../models'; +/** + * WalletApi - axios parameter creator + * @export + */ +export const WalletApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * A user can only have 1 unique Cashout Method of any type at a time (eg. they can't create multiple paypal payout methods). Cashout Methods cannot be edited, they can only be created or deleted. Creating different Cashout Methods will require type-dependent request data attributes in order to be successfully created. Currently only creating paypal or Cash in Mail cashout methods are supported + * @summary Create Cashout Method + * @param {any} body + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createCashoutMethodProductIdCashoutMethodsPost: async (body: any, productId: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling createCashoutMethodProductIdCashoutMethodsPost.'); + } + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling createCashoutMethodProductIdCashoutMethodsPost.'); + } + const localVarPath = `/{product_id}/cashout_methods/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Delete a cashout method + * @summary Delete Cashout Method + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} cashoutMethodId The ID of the cashout method to delete + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteCashoutMethodProductIdCashoutMethodsCashoutMethodIdDelete: async (productId: any, cashoutMethodId: any, bpuid: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling deleteCashoutMethodProductIdCashoutMethodsCashoutMethodIdDelete.'); + } + // verify required parameter 'cashoutMethodId' is not null or undefined + if (cashoutMethodId === null || cashoutMethodId === undefined) { + throw new RequiredError('cashoutMethodId','Required parameter cashoutMethodId was null or undefined when calling deleteCashoutMethodProductIdCashoutMethodsCashoutMethodIdDelete.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling deleteCashoutMethodProductIdCashoutMethodsCashoutMethodIdDelete.'); + } + const localVarPath = `/{product_id}/cashout_methods/{cashout_method_id}/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))) + .replace(`{${"cashout_method_id"}}`, encodeURIComponent(String(cashoutMethodId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Retrieve the details for a specific Cashout event + * @summary Get Cashout Detail + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} cashoutId The cashout event ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCashoutDetailProductIdCashoutCashoutIdGet: async (productId: any, cashoutId: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling getCashoutDetailProductIdCashoutCashoutIdGet.'); + } + // verify required parameter 'cashoutId' is not null or undefined + if (cashoutId === null || cashoutId === undefined) { + throw new RequiredError('cashoutId','Required parameter cashoutId was null or undefined when calling getCashoutDetailProductIdCashoutCashoutIdGet.'); + } + const localVarPath = `/{product_id}/cashout/{cashout_id}/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))) + .replace(`{${"cashout_id"}}`, encodeURIComponent(String(cashoutId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Retrieve the current available mechanisms that a user can use to retrieve funds. + * @summary Get Cashout Methods + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCashoutMethodsProductIdCashoutMethodsGet: async (productId: any, bpuid: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling getCashoutMethodsProductIdCashoutMethodsGet.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling getCashoutMethodsProductIdCashoutMethodsGet.'); + } + const localVarPath = `/{product_id}/cashout_methods/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Use this function to get the \"value\" (in local currency, e.g. CAD, BTC) for this cashout_method, for amount (in USD cents). + * @summary Get Expected Redemption Value + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} cashoutMethodId The ID of the cashout method + * @param {any} amount (USD cents) The amount to convert + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExpectedRedemptionValueProductIdCashoutMethodCashoutMethodIdValueGet: async (productId: any, cashoutMethodId: any, amount: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling getExpectedRedemptionValueProductIdCashoutMethodCashoutMethodIdValueGet.'); + } + // verify required parameter 'cashoutMethodId' is not null or undefined + if (cashoutMethodId === null || cashoutMethodId === undefined) { + throw new RequiredError('cashoutMethodId','Required parameter cashoutMethodId was null or undefined when calling getExpectedRedemptionValueProductIdCashoutMethodCashoutMethodIdValueGet.'); + } + // verify required parameter 'amount' is not null or undefined + if (amount === null || amount === undefined) { + throw new RequiredError('amount','Required parameter amount was null or undefined when calling getExpectedRedemptionValueProductIdCashoutMethodCashoutMethodIdValueGet.'); + } + const localVarPath = `/{product_id}/cashout_method/{cashout_method_id}/value/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))) + .replace(`{${"cashout_method_id"}}`, encodeURIComponent(String(cashoutMethodId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (amount !== undefined) { + localVarQueryParameter['amount'] = amount; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Return array of user events that altered their wallet balance + * @summary Get User Transaction History + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserTransactionHistoryProductIdTransactionHistoryGet: async (productId: any, bpuid: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling getUserTransactionHistoryProductIdTransactionHistoryGet.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling getUserTransactionHistoryProductIdTransactionHistoryGet.'); + } + const localVarPath = `/{product_id}/transaction_history/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Retrieve the current balance of a respondent's wallet balance for display + * @summary Get User Wallet Balance + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserWalletBalanceProductIdWalletGet: async (productId: any, bpuid: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling getUserWalletBalanceProductIdWalletGet.'); + } + // verify required parameter 'bpuid' is not null or undefined + if (bpuid === null || bpuid === undefined) { + throw new RequiredError('bpuid','Required parameter bpuid was null or undefined when calling getUserWalletBalanceProductIdWalletGet.'); + } + const localVarPath = `/{product_id}/wallet/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (bpuid !== undefined) { + localVarQueryParameter['bpuid'] = bpuid; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Request a cashout taken from a user's available wallet balance, to be paid via a particular cashout method. + * @summary Submit User Cashout + * @param {CreateCashoutRequest} body + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + submitUserCashoutProductIdCashoutPost: async (body: CreateCashoutRequest, productId: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling submitUserCashoutProductIdCashoutPost.'); + } + // verify required parameter 'productId' is not null or undefined + if (productId === null || productId === undefined) { + throw new RequiredError('productId','Required parameter productId was null or undefined when calling submitUserCashoutProductIdCashoutPost.'); + } + const localVarPath = `/{product_id}/cashout/` + .replace(`{${"product_id"}}`, encodeURIComponent(String(productId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * WalletApi - functional programming interface + * @export + */ +export const WalletApiFp = function(configuration?: Configuration) { + return { + /** + * A user can only have 1 unique Cashout Method of any type at a time (eg. they can't create multiple paypal payout methods). Cashout Methods cannot be edited, they can only be created or deleted. Creating different Cashout Methods will require type-dependent request data attributes in order to be successfully created. Currently only creating paypal or Cash in Mail cashout methods are supported + * @summary Create Cashout Method + * @param {any} body + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createCashoutMethodProductIdCashoutMethodsPost(body: any, productId: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<CashoutMethodResponse>>> { + const localVarAxiosArgs = await WalletApiAxiosParamCreator(configuration).createCashoutMethodProductIdCashoutMethodsPost(body, productId, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Delete a cashout method + * @summary Delete Cashout Method + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} cashoutMethodId The ID of the cashout method to delete + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteCashoutMethodProductIdCashoutMethodsCashoutMethodIdDelete(productId: any, cashoutMethodId: any, bpuid: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<StatusResponse>>> { + const localVarAxiosArgs = await WalletApiAxiosParamCreator(configuration).deleteCashoutMethodProductIdCashoutMethodsCashoutMethodIdDelete(productId, cashoutMethodId, bpuid, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Retrieve the details for a specific Cashout event + * @summary Get Cashout Detail + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} cashoutId The cashout event ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getCashoutDetailProductIdCashoutCashoutIdGet(productId: any, cashoutId: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<CashoutRequestResponse>>> { + const localVarAxiosArgs = await WalletApiAxiosParamCreator(configuration).getCashoutDetailProductIdCashoutCashoutIdGet(productId, cashoutId, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Retrieve the current available mechanisms that a user can use to retrieve funds. + * @summary Get Cashout Methods + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getCashoutMethodsProductIdCashoutMethodsGet(productId: any, bpuid: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<CashoutMethodsResponse>>> { + const localVarAxiosArgs = await WalletApiAxiosParamCreator(configuration).getCashoutMethodsProductIdCashoutMethodsGet(productId, bpuid, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Use this function to get the \"value\" (in local currency, e.g. CAD, BTC) for this cashout_method, for amount (in USD cents). + * @summary Get Expected Redemption Value + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} cashoutMethodId The ID of the cashout method + * @param {any} amount (USD cents) The amount to convert + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getExpectedRedemptionValueProductIdCashoutMethodCashoutMethodIdValueGet(productId: any, cashoutMethodId: any, amount: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<CashoutMethodForeignValueResponse>>> { + const localVarAxiosArgs = await WalletApiAxiosParamCreator(configuration).getExpectedRedemptionValueProductIdCashoutMethodCashoutMethodIdValueGet(productId, cashoutMethodId, amount, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Return array of user events that altered their wallet balance + * @summary Get User Transaction History + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getUserTransactionHistoryProductIdTransactionHistoryGet(productId: any, bpuid: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<UserTransactionHistoryResponse>>> { + const localVarAxiosArgs = await WalletApiAxiosParamCreator(configuration).getUserTransactionHistoryProductIdTransactionHistoryGet(productId, bpuid, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Retrieve the current balance of a respondent's wallet balance for display + * @summary Get User Wallet Balance + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getUserWalletBalanceProductIdWalletGet(productId: any, bpuid: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<UserWalletBalanceResponse>>> { + const localVarAxiosArgs = await WalletApiAxiosParamCreator(configuration).getUserWalletBalanceProductIdWalletGet(productId, bpuid, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * Request a cashout taken from a user's available wallet balance, to be paid via a particular cashout method. + * @summary Submit User Cashout + * @param {CreateCashoutRequest} body + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async submitUserCashoutProductIdCashoutPost(body: CreateCashoutRequest, productId: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<CashoutRequestResponse>>> { + const localVarAxiosArgs = await WalletApiAxiosParamCreator(configuration).submitUserCashoutProductIdCashoutPost(body, productId, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * WalletApi - factory interface + * @export + */ +export const WalletApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + return { + /** + * A user can only have 1 unique Cashout Method of any type at a time (eg. they can't create multiple paypal payout methods). Cashout Methods cannot be edited, they can only be created or deleted. Creating different Cashout Methods will require type-dependent request data attributes in order to be successfully created. Currently only creating paypal or Cash in Mail cashout methods are supported + * @summary Create Cashout Method + * @param {any} body + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createCashoutMethodProductIdCashoutMethodsPost(body: any, productId: any, options?: AxiosRequestConfig): Promise<AxiosResponse<CashoutMethodResponse>> { + return WalletApiFp(configuration).createCashoutMethodProductIdCashoutMethodsPost(body, productId, options).then((request) => request(axios, basePath)); + }, + /** + * Delete a cashout method + * @summary Delete Cashout Method + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} cashoutMethodId The ID of the cashout method to delete + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteCashoutMethodProductIdCashoutMethodsCashoutMethodIdDelete(productId: any, cashoutMethodId: any, bpuid: any, options?: AxiosRequestConfig): Promise<AxiosResponse<StatusResponse>> { + return WalletApiFp(configuration).deleteCashoutMethodProductIdCashoutMethodsCashoutMethodIdDelete(productId, cashoutMethodId, bpuid, options).then((request) => request(axios, basePath)); + }, + /** + * Retrieve the details for a specific Cashout event + * @summary Get Cashout Detail + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} cashoutId The cashout event ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getCashoutDetailProductIdCashoutCashoutIdGet(productId: any, cashoutId: any, options?: AxiosRequestConfig): Promise<AxiosResponse<CashoutRequestResponse>> { + return WalletApiFp(configuration).getCashoutDetailProductIdCashoutCashoutIdGet(productId, cashoutId, options).then((request) => request(axios, basePath)); + }, + /** + * Retrieve the current available mechanisms that a user can use to retrieve funds. + * @summary Get Cashout Methods + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getCashoutMethodsProductIdCashoutMethodsGet(productId: any, bpuid: any, options?: AxiosRequestConfig): Promise<AxiosResponse<CashoutMethodsResponse>> { + return WalletApiFp(configuration).getCashoutMethodsProductIdCashoutMethodsGet(productId, bpuid, options).then((request) => request(axios, basePath)); + }, + /** + * Use this function to get the \"value\" (in local currency, e.g. CAD, BTC) for this cashout_method, for amount (in USD cents). + * @summary Get Expected Redemption Value + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} cashoutMethodId The ID of the cashout method + * @param {any} amount (USD cents) The amount to convert + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getExpectedRedemptionValueProductIdCashoutMethodCashoutMethodIdValueGet(productId: any, cashoutMethodId: any, amount: any, options?: AxiosRequestConfig): Promise<AxiosResponse<CashoutMethodForeignValueResponse>> { + return WalletApiFp(configuration).getExpectedRedemptionValueProductIdCashoutMethodCashoutMethodIdValueGet(productId, cashoutMethodId, amount, options).then((request) => request(axios, basePath)); + }, + /** + * Return array of user events that altered their wallet balance + * @summary Get User Transaction History + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getUserTransactionHistoryProductIdTransactionHistoryGet(productId: any, bpuid: any, options?: AxiosRequestConfig): Promise<AxiosResponse<UserTransactionHistoryResponse>> { + return WalletApiFp(configuration).getUserTransactionHistoryProductIdTransactionHistoryGet(productId, bpuid, options).then((request) => request(axios, basePath)); + }, + /** + * Retrieve the current balance of a respondent's wallet balance for display + * @summary Get User Wallet Balance + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getUserWalletBalanceProductIdWalletGet(productId: any, bpuid: any, options?: AxiosRequestConfig): Promise<AxiosResponse<UserWalletBalanceResponse>> { + return WalletApiFp(configuration).getUserWalletBalanceProductIdWalletGet(productId, bpuid, options).then((request) => request(axios, basePath)); + }, + /** + * Request a cashout taken from a user's available wallet balance, to be paid via a particular cashout method. + * @summary Submit User Cashout + * @param {CreateCashoutRequest} body + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async submitUserCashoutProductIdCashoutPost(body: CreateCashoutRequest, productId: any, options?: AxiosRequestConfig): Promise<AxiosResponse<CashoutRequestResponse>> { + return WalletApiFp(configuration).submitUserCashoutProductIdCashoutPost(body, productId, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * WalletApi - object-oriented interface + * @export + * @class WalletApi + * @extends {BaseAPI} + */ +export class WalletApi extends BaseAPI { + /** + * A user can only have 1 unique Cashout Method of any type at a time (eg. they can't create multiple paypal payout methods). Cashout Methods cannot be edited, they can only be created or deleted. Creating different Cashout Methods will require type-dependent request data attributes in order to be successfully created. Currently only creating paypal or Cash in Mail cashout methods are supported + * @summary Create Cashout Method + * @param {any} body + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof WalletApi + */ + public async createCashoutMethodProductIdCashoutMethodsPost(body: any, productId: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<CashoutMethodResponse>> { + return WalletApiFp(this.configuration).createCashoutMethodProductIdCashoutMethodsPost(body, productId, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Delete a cashout method + * @summary Delete Cashout Method + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} cashoutMethodId The ID of the cashout method to delete + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof WalletApi + */ + public async deleteCashoutMethodProductIdCashoutMethodsCashoutMethodIdDelete(productId: any, cashoutMethodId: any, bpuid: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<StatusResponse>> { + return WalletApiFp(this.configuration).deleteCashoutMethodProductIdCashoutMethodsCashoutMethodIdDelete(productId, cashoutMethodId, bpuid, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Retrieve the details for a specific Cashout event + * @summary Get Cashout Detail + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} cashoutId The cashout event ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof WalletApi + */ + public async getCashoutDetailProductIdCashoutCashoutIdGet(productId: any, cashoutId: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<CashoutRequestResponse>> { + return WalletApiFp(this.configuration).getCashoutDetailProductIdCashoutCashoutIdGet(productId, cashoutId, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Retrieve the current available mechanisms that a user can use to retrieve funds. + * @summary Get Cashout Methods + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof WalletApi + */ + public async getCashoutMethodsProductIdCashoutMethodsGet(productId: any, bpuid: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<CashoutMethodsResponse>> { + return WalletApiFp(this.configuration).getCashoutMethodsProductIdCashoutMethodsGet(productId, bpuid, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Use this function to get the \"value\" (in local currency, e.g. CAD, BTC) for this cashout_method, for amount (in USD cents). + * @summary Get Expected Redemption Value + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} cashoutMethodId The ID of the cashout method + * @param {any} amount (USD cents) The amount to convert + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof WalletApi + */ + public async getExpectedRedemptionValueProductIdCashoutMethodCashoutMethodIdValueGet(productId: any, cashoutMethodId: any, amount: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<CashoutMethodForeignValueResponse>> { + return WalletApiFp(this.configuration).getExpectedRedemptionValueProductIdCashoutMethodCashoutMethodIdValueGet(productId, cashoutMethodId, amount, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Return array of user events that altered their wallet balance + * @summary Get User Transaction History + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof WalletApi + */ + public async getUserTransactionHistoryProductIdTransactionHistoryGet(productId: any, bpuid: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<UserTransactionHistoryResponse>> { + return WalletApiFp(this.configuration).getUserTransactionHistoryProductIdTransactionHistoryGet(productId, bpuid, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Retrieve the current balance of a respondent's wallet balance for display + * @summary Get User Wallet Balance + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {any} bpuid A unique identifier for each user, which is set by the Supplier. Must be consistent across respondent entrances and unique to the platform. It should not contain any sensitive information like email or names, and should avoid using any incrementing values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof WalletApi + */ + public async getUserWalletBalanceProductIdWalletGet(productId: any, bpuid: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<UserWalletBalanceResponse>> { + return WalletApiFp(this.configuration).getUserWalletBalanceProductIdWalletGet(productId, bpuid, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Request a cashout taken from a user's available wallet balance, to be paid via a particular cashout method. + * @summary Submit User Cashout + * @param {CreateCashoutRequest} body + * @param {any} productId The Brokerage Product ID provided by GRL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof WalletApi + */ + public async submitUserCashoutProductIdCashoutPost(body: CreateCashoutRequest, productId: any, options?: AxiosRequestConfig) : Promise<AxiosResponse<CashoutRequestResponse>> { + return WalletApiFp(this.configuration).submitUserCashoutProductIdCashoutPost(body, productId, options).then((request) => request(this.axios, this.basePath)); + } +} diff --git a/src/api/base.ts b/src/api/base.ts new file mode 100644 index 0000000..b7b4ed1 --- /dev/null +++ b/src/api/base.ts @@ -0,0 +1,70 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { Configuration } from "./configuration"; +// Some imports not used depending on template conditions +// @ts-ignore +import globalAxios, { AxiosRequestConfig, AxiosInstance } from 'axios'; + +export const BASE_PATH = "https://fsb.generalresearch.com/".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: AxiosRequestConfig; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} diff --git a/src/api/configuration.ts b/src/api/configuration.ts new file mode 100644 index 0000000..6d621b1 --- /dev/null +++ b/src/api/configuration.ts @@ -0,0 +1,83 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +export interface ConfigurationParameters { + apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>); + username?: string; + password?: string; + accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>); + basePath?: string; + baseOptions?: any; +} + +export class Configuration { + + /** + * parameter for apiKey security + * + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>); + + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + + /** + * parameter for oauth2 security + * + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>); + + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; + } +} diff --git a/src/api/git_push.sh b/src/api/git_push.sh new file mode 100644 index 0000000..68a0a83 --- /dev/null +++ b/src/api/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh hugomario swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/src/api/index.ts b/src/api/index.ts new file mode 100644 index 0000000..c46056b --- /dev/null +++ b/src/api/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +export * from "./api"; +export * from "./configuration"; +export * from "./models"; + diff --git a/src/api/models/amt-cashout-method-data.ts b/src/api/models/amt-cashout-method-data.ts new file mode 100644 index 0000000..f0f39b9 --- /dev/null +++ b/src/api/models/amt-cashout-method-data.ts @@ -0,0 +1,28 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface AmtCashoutMethodData + */ +export interface AmtCashoutMethodData { + + /** + * @type {any} + * @memberof AmtCashoutMethodData + */ + type?: any; +} diff --git a/src/api/models/body-offerwall-softpair-post-product-id-offerwall37d1da64-offerwall-id-post.ts b/src/api/models/body-offerwall-softpair-post-product-id-offerwall37d1da64-offerwall-id-post.ts new file mode 100644 index 0000000..0893119 --- /dev/null +++ b/src/api/models/body-offerwall-softpair-post-product-id-offerwall37d1da64-offerwall-id-post.ts @@ -0,0 +1,28 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface BodyOfferwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost + */ +export interface BodyOfferwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost { + + /** + * @type {any} + * @memberof BodyOfferwallSoftpairPostProductIdOfferwall37d1da64OfferwallIdPost + */ + answers: any; +} diff --git a/src/api/models/body-submit-profiling-questions-product-id-profiling-questions-post.ts b/src/api/models/body-submit-profiling-questions-product-id-profiling-questions-post.ts new file mode 100644 index 0000000..dc83e7d --- /dev/null +++ b/src/api/models/body-submit-profiling-questions-product-id-profiling-questions-post.ts @@ -0,0 +1,28 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface BodySubmitProfilingQuestionsProductIdProfilingQuestionsPost + */ +export interface BodySubmitProfilingQuestionsProductIdProfilingQuestionsPost { + + /** + * @type {any} + * @memberof BodySubmitProfilingQuestionsProductIdProfilingQuestionsPost + */ + answers: any; +} diff --git a/src/api/models/bucket-task.ts b/src/api/models/bucket-task.ts new file mode 100644 index 0000000..280d844 --- /dev/null +++ b/src/api/models/bucket-task.ts @@ -0,0 +1,60 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * This represents one of the \"tasks\" within a bucket's ordered list of tasks. + * + * @export + * @interface BucketTask + */ +export interface BucketTask { + + /** + * The internal task id for this task within the marketplace + * + * @type {any} + * @memberof BucketTask + */ + id: any; + + /** + * The namespaced task id for this task within the marketplace + * + * @type {any} + * @memberof BucketTask + */ + idCode: any; + + /** + * @type {any} + * @memberof BucketTask + */ + source: any; + + /** + * expected loi in seconds + * + * @type {any} + * @memberof BucketTask + */ + loi: any; + + /** + * integer cents + * + * @type {any} + * @memberof BucketTask + */ + payout: any; +} diff --git a/src/api/models/cardinality.ts b/src/api/models/cardinality.ts new file mode 100644 index 0000000..1e77879 --- /dev/null +++ b/src/api/models/cardinality.ts @@ -0,0 +1,24 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * + * @export + * @enum {string} + */ +export enum Cardinality { + Star = '*', + QuestionMark = '?' +} + diff --git a/src/api/models/cash-mail-cashout-method-data.ts b/src/api/models/cash-mail-cashout-method-data.ts new file mode 100644 index 0000000..f0f9248 --- /dev/null +++ b/src/api/models/cash-mail-cashout-method-data.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface CashMailCashoutMethodData + */ +export interface CashMailCashoutMethodData { + + /** + * @type {any} + * @memberof CashMailCashoutMethodData + */ + type?: any; + + /** + * Delivery address where payment should be sent + * + * @type {any} + * @memberof CashMailCashoutMethodData + */ + deliveryAddress: any; +} diff --git a/src/api/models/cashout-method-foreign-value-response.ts b/src/api/models/cashout-method-foreign-value-response.ts new file mode 100644 index 0000000..08f7e3d --- /dev/null +++ b/src/api/models/cashout-method-foreign-value-response.ts @@ -0,0 +1,45 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { CashoutMethodForeignValue } from './cashout-method-foreign-value'; + /** + * + * + * @export + * @interface CashoutMethodForeignValueResponse + */ +export interface CashoutMethodForeignValueResponse { + + /** + * The status of the API response. + * + * @type {any} + * @memberof CashoutMethodForeignValueResponse + */ + status: any; + + /** + * An optional message, if the status is error. + * + * @type {any} + * @memberof CashoutMethodForeignValueResponse + */ + msg?: any; + + /** + * @type {CashoutMethodForeignValue} + * @memberof CashoutMethodForeignValueResponse + */ + cashoutMethodValue: CashoutMethodForeignValue; +} diff --git a/src/api/models/cashout-method-foreign-value.ts b/src/api/models/cashout-method-foreign-value.ts new file mode 100644 index 0000000..565304e --- /dev/null +++ b/src/api/models/cashout-method-foreign-value.ts @@ -0,0 +1,46 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Shows the expected value of a redemption in a foreign currency. + * + * @export + * @interface CashoutMethodForeignValue + */ +export interface CashoutMethodForeignValue { + + /** + * Value of the redemption in the currency's smallest unit. + * + * @type {any} + * @memberof CashoutMethodForeignValue + */ + value: any; + + /** + * Supported Currencies for Foreign Redemptions Allowed values: - __USD__ *(USD)*: US Dollars. Smallest Unit: Cents. - __CAD__ *(CAD)*: Canadian Dollars. Smallest Unit: Cents. - __GBP__ *(GBP)*: British Pounds. Smallest Unit: Pence. - __EUR__ *(EUR)*: Euros. Smallest Unit: Cents. - __INR__ *(INR)*: Indian Rupees. Smallest Unit: Paise. - __AUD__ *(AUD)*: Australian Dollars. Smallest Unit: Cents. - __PLN__ *(PLN)*: Polish Zloty. Smallest Unit: Grosz. - __SEK__ *(SEK)*: Swedish Krona. Smallest Unit: Öre. - __SGD__ *(SGD)*: Singapore Dollars. Smallest Unit: Cents. - __MXN__ *(MXN)*: Mexican Pesos. Smallest Unit: Centavos. + * + * @type {any} + * @memberof CashoutMethodForeignValue + */ + currency: any; + + /** + * A string representation of the value in the currency. + * + * @type {any} + * @memberof CashoutMethodForeignValue + */ + valueString: any; +} diff --git a/src/api/models/cashout-method-out.ts b/src/api/models/cashout-method-out.ts new file mode 100644 index 0000000..762a4a6 --- /dev/null +++ b/src/api/models/cashout-method-out.ts @@ -0,0 +1,122 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface CashoutMethodOut + */ +export interface CashoutMethodOut { + + /** + * Unique ID for this cashout method + * + * @type {any} + * @memberof CashoutMethodOut + */ + id: any; + + /** + * The currency of the cashout. Only USD is supported. + * + * @type {any} + * @memberof CashoutMethodOut + */ + currency?: any; + + /** + * The base currency of the money paid out. This is used for e.g. sending an Amazon UK gift card + * + * @type {any} + * @memberof CashoutMethodOut + */ + originalCurrency?: any; + + /** + * @type {any} + * @memberof CashoutMethodOut + */ + data: any; + + /** + * The description of the cashout method. + * + * @type {any} + * @memberof CashoutMethodOut + */ + description: any; + + /** + * Link to an image to display + * + * @type {any} + * @memberof CashoutMethodOut + */ + imageUrl?: any; + + /** + * (USD cents) The maximum amount that can be cashed out in one transaction. + * + * @type {any} + * @memberof CashoutMethodOut + */ + maxValue: any; + + /** + * (USD cents) The minimum amount that can be cashed out in one transaction. + * + * @type {any} + * @memberof CashoutMethodOut + */ + minValue: any; + + /** + * A descriptive name for the cashout method. + * + * @type {any} + * @memberof CashoutMethodOut + */ + name: any; + + /** + * The method in which the requested payout is delivered. Allowed values: - __PAYPAL__ *(PAYPAL)*: User is paid out to their personal PayPal email address - __TANGO__ *(TANGO)*: User is paid uut via a Tango Gift Card - __dwolla__ *(DWOLLA)*: DWOLLA - __ACH__ *(ACH)*: A payment is made to a bank account using ACH - __CASH_IN_MAIL__ *(CASH_IN_MAIL)*: A payment is made in cash and mailed to the user. - __PRIZE__ *(PRIZE)*: A payment is made as a prize with some monetary value - __AMT__ *(AMT)*: This is used to designate either AMT_BONUS or AMT_HIT - __amt_bonus__ *(AMT_BONUS)*: Amazon Mechanical Turk as a Bonus - __amt_assignment__ *(AMT_HIT)*: Amazon Mechanical Turk for a HIT + * + * @type {any} + * @memberof CashoutMethodOut + */ + type: any; + + /** + * An external ID. Can be shown to a user to disambiguate a user'spossibly multiple methods + * + * @type {any} + * @memberof CashoutMethodOut + */ + extId?: any; + + /** + * @type {any} + * @memberof CashoutMethodOut + */ + productId?: any; + + /** + * A unique identifier for each user, which is set by the Supplier. It should not contain any sensitive informationlike email or names, and should avoid using anyincrementing values. + * + * @type {any} + * @memberof CashoutMethodOut + */ + productUserId?: any; +} diff --git a/src/api/models/cashout-method-response.ts b/src/api/models/cashout-method-response.ts new file mode 100644 index 0000000..70b6c68 --- /dev/null +++ b/src/api/models/cashout-method-response.ts @@ -0,0 +1,45 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { CashoutMethodOut } from './cashout-method-out'; + /** + * + * + * @export + * @interface CashoutMethodResponse + */ +export interface CashoutMethodResponse { + + /** + * The status of the API response. + * + * @type {any} + * @memberof CashoutMethodResponse + */ + status: any; + + /** + * An optional message, if the status is error. + * + * @type {any} + * @memberof CashoutMethodResponse + */ + msg?: any; + + /** + * @type {CashoutMethodOut} + * @memberof CashoutMethodResponse + */ + cashoutMethod: CashoutMethodOut; +} diff --git a/src/api/models/cashout-methods-response.ts b/src/api/models/cashout-methods-response.ts new file mode 100644 index 0000000..3b5b21a --- /dev/null +++ b/src/api/models/cashout-methods-response.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface CashoutMethodsResponse + */ +export interface CashoutMethodsResponse { + + /** + * The status of the API response. + * + * @type {any} + * @memberof CashoutMethodsResponse + */ + status: any; + + /** + * An optional message, if the status is error. + * + * @type {any} + * @memberof CashoutMethodsResponse + */ + msg?: any; + + /** + * @type {any} + * @memberof CashoutMethodsResponse + */ + cashoutMethods: any; +} diff --git a/src/api/models/cashout-request-info.ts b/src/api/models/cashout-request-info.ts new file mode 100644 index 0000000..3186ec0 --- /dev/null +++ b/src/api/models/cashout-request-info.ts @@ -0,0 +1,58 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * See models.thl.payout: PayoutEvent. We've confused a Cashout and a Payout. This is used only in the API response. + * + * @export + * @interface CashoutRequestInfo + */ +export interface CashoutRequestInfo { + + /** + * Unique ID for this cashout. This may be NULL if the status is REJECTED or FAILED, which may happen if the request is invalid. + * + * @type {any} + * @memberof CashoutRequestInfo + */ + id: any; + + /** + * This is the name of the cashout method. + * + * @type {any} + * @memberof CashoutRequestInfo + */ + description: any; + + /** + * @type {any} + * @memberof CashoutRequestInfo + */ + message?: any; + + /** + * - `PENDING` = PENDING - `APPROVED` = APPROVED - `REJECTED` = REJECTED - `CANCELLED` = CANCELLED - `FAILED` = FAILED - `COMPLETE` = COMPLETE + * + * @type {any} + * @memberof CashoutRequestInfo + */ + status?: any; + + /** + * @type {any} + * @memberof CashoutRequestInfo + */ + transactionInfo?: any; +} diff --git a/src/api/models/cashout-request-response.ts b/src/api/models/cashout-request-response.ts new file mode 100644 index 0000000..6f56a2f --- /dev/null +++ b/src/api/models/cashout-request-response.ts @@ -0,0 +1,45 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { CashoutRequestInfo } from './cashout-request-info'; + /** + * + * + * @export + * @interface CashoutRequestResponse + */ +export interface CashoutRequestResponse { + + /** + * The status of the API response. + * + * @type {any} + * @memberof CashoutRequestResponse + */ + status: any; + + /** + * An optional message, if the status is error. + * + * @type {any} + * @memberof CashoutRequestResponse + */ + msg?: any; + + /** + * @type {CashoutRequestInfo} + * @memberof CashoutRequestResponse + */ + cashout: CashoutRequestInfo; +} diff --git a/src/api/models/category-association.ts b/src/api/models/category-association.ts new file mode 100644 index 0000000..356754b --- /dev/null +++ b/src/api/models/category-association.ts @@ -0,0 +1,58 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Used in an offerwall. Stores the association between a category and a bucket, with a score. + * + * @export + * @interface CategoryAssociation + */ +export interface CategoryAssociation { + + /** + * The category ID + * + * @type {any} + * @memberof CategoryAssociation + */ + id: any; + + /** + * The category label + * + * @type {any} + * @memberof CategoryAssociation + */ + label: any; + + /** + * @type {any} + * @memberof CategoryAssociation + */ + adwordsId?: any; + + /** + * @type {any} + * @memberof CategoryAssociation + */ + adwordsLabel?: any; + + /** + * The strength of the association of this bucketwith this category. Will sum to 1 within a bucket. + * + * @type {any} + * @memberof CategoryAssociation + */ + p: any; +} diff --git a/src/api/models/category.ts b/src/api/models/category.ts new file mode 100644 index 0000000..e3c53cf --- /dev/null +++ b/src/api/models/category.ts @@ -0,0 +1,52 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface Category + */ +export interface Category { + + /** + * @type {any} + * @memberof Category + */ + id: any; + + /** + * @type {any} + * @memberof Category + */ + adwordsVerticalId?: any; + + /** + * @type {any} + * @memberof Category + */ + label: any; + + /** + * @type {any} + * @memberof Category + */ + path: any; + + /** + * @type {any} + * @memberof Category + */ + parentId?: any; +} diff --git a/src/api/models/count-stat.ts b/src/api/models/count-stat.ts new file mode 100644 index 0000000..1434d6e --- /dev/null +++ b/src/api/models/count-stat.ts @@ -0,0 +1,38 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface CountStat + */ +export interface CountStat { + + /** + * The grouping criteria + * + * @type {any} + * @memberof CountStat + */ + facet: any; + + /** + * The count value for the given metric and facet + * + * @type {any} + * @memberof CountStat + */ + count: any; +} diff --git a/src/api/models/create-cash-mail-cashout-method-request.ts b/src/api/models/create-cash-mail-cashout-method-request.ts new file mode 100644 index 0000000..3041747 --- /dev/null +++ b/src/api/models/create-cash-mail-cashout-method-request.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface CreateCashMailCashoutMethodRequest + */ +export interface CreateCashMailCashoutMethodRequest { + + /** + * (product_user_id) The user to create this cashout method for. + * + * @type {any} + * @memberof CreateCashMailCashoutMethodRequest + */ + bpuid: any; + + /** + * @type {any} + * @memberof CreateCashMailCashoutMethodRequest + */ + type?: any; + + /** + * Delivery address where payment should be sent + * + * @type {any} + * @memberof CreateCashMailCashoutMethodRequest + */ + deliveryAddress: any; +} diff --git a/src/api/models/create-cashout-request.ts b/src/api/models/create-cashout-request.ts new file mode 100644 index 0000000..5a8ca5b --- /dev/null +++ b/src/api/models/create-cashout-request.ts @@ -0,0 +1,46 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface CreateCashoutRequest + */ +export interface CreateCashoutRequest { + + /** + * (product_user_id) The user requesting a cashout. + * + * @type {any} + * @memberof CreateCashoutRequest + */ + bpuid: any; + + /** + * (USD cents) The amount requested for the cashout. + * + * @type {any} + * @memberof CreateCashoutRequest + */ + amount: any; + + /** + * Unique ID for the cashout method the cashout is being requested with. + * + * @type {any} + * @memberof CreateCashoutRequest + */ + cashoutMethodId: any; +} diff --git a/src/api/models/create-pay-pal-cashout-method-request.ts b/src/api/models/create-pay-pal-cashout-method-request.ts new file mode 100644 index 0000000..c493267 --- /dev/null +++ b/src/api/models/create-pay-pal-cashout-method-request.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface CreatePayPalCashoutMethodRequest + */ +export interface CreatePayPalCashoutMethodRequest { + + /** + * (product_user_id) The user to create this cashout method for. + * + * @type {any} + * @memberof CreatePayPalCashoutMethodRequest + */ + bpuid: any; + + /** + * @type {any} + * @memberof CreatePayPalCashoutMethodRequest + */ + type?: any; + + /** + * Email address of the paypal user + * + * @type {any} + * @memberof CreatePayPalCashoutMethodRequest + */ + email: any; +} diff --git a/src/api/models/duration-summary.ts b/src/api/models/duration-summary.ts new file mode 100644 index 0000000..86693a1 --- /dev/null +++ b/src/api/models/duration-summary.ts @@ -0,0 +1,70 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Durations are in integer seconds. Describes the statistical distribution of expected durations of tasks within this bucket. + * + * @export + * @interface DurationSummary + */ +export interface DurationSummary { + + /** + * @type {any} + * @memberof DurationSummary + */ + min: any; + + /** + * @type {any} + * @memberof DurationSummary + */ + max: any; + + /** + * @type {any} + * @memberof DurationSummary + */ + mean?: any; + + /** + * @type {any} + * @memberof DurationSummary + */ + q1: any; + + /** + * @type {any} + * @memberof DurationSummary + */ + q2: any; + + /** + * @type {any} + * @memberof DurationSummary + */ + q3: any; + + /** + * @type {any} + * @memberof DurationSummary + */ + lowerWhisker: any; + + /** + * @type {any} + * @memberof DurationSummary + */ + upperWhisker: any; +} diff --git a/src/api/models/httpvalidation-error.ts b/src/api/models/httpvalidation-error.ts new file mode 100644 index 0000000..93d7610 --- /dev/null +++ b/src/api/models/httpvalidation-error.ts @@ -0,0 +1,28 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface HTTPValidationError + */ +export interface HTTPValidationError { + + /** + * @type {any} + * @memberof HTTPValidationError + */ + detail?: any; +} diff --git a/src/api/models/index.ts b/src/api/models/index.ts new file mode 100644 index 0000000..f8e599c --- /dev/null +++ b/src/api/models/index.ts @@ -0,0 +1,119 @@ +export * from './amt-cashout-method-data'; +export * from './body-offerwall-softpair-post-product-id-offerwall37d1da64-offerwall-id-post'; +export * from './body-submit-profiling-questions-product-id-profiling-questions-post'; +export * from './bucket-task'; +export * from './cardinality'; +export * from './cash-mail-cashout-method-data'; +export * from './cashout-method-foreign-value'; +export * from './cashout-method-foreign-value-response'; +export * from './cashout-method-out'; +export * from './cashout-method-response'; +export * from './cashout-methods-response'; +export * from './cashout-request-info'; +export * from './cashout-request-response'; +export * from './category'; +export * from './category-association'; +export * from './count-stat'; +export * from './create-cash-mail-cashout-method-request'; +export * from './create-cashout-request'; +export * from './create-pay-pal-cashout-method-request'; +export * from './duration-summary'; +export * from './httpvalidation-error'; +export * from './leaderboard'; +export * from './leaderboard-code'; +export * from './leaderboard-frequency'; +export * from './leaderboard-response'; +export * from './leaderboard-row'; +export * from './leaderboard-winner'; +export * from './leaderboard-winner-response'; +export * from './market-profile-knowledge'; +export * from './marketplace-bucket'; +export * from './marketplace-inventory-summary'; +export * from './marketplace-offerwall'; +export * from './marketplace-offerwall-response'; +export * from './marketplace-summary'; +export * from './offer-wall-info'; +export * from './one-shot-offerwall'; +export * from './one-shot-offerwall-bucket'; +export * from './one-shot-offerwall-response'; +export * from './pattern-validation'; +export * from './payout-status'; +export * from './payout-summary'; +export * from './payout-type'; +export * from './paypal-cashout-method-data'; +export * from './profiling-info-response'; +export * from './property-type'; +export * from './question-info'; +export * from './question-option'; +export * from './redemption-currency'; +export * from './report-task'; +export * from './report-value'; +export * from './session-adjusted-status'; +export * from './session-status-code2'; +export * from './single-entry-bucket'; +export * from './single-entry-offer-wall'; +export * from './single-entry-offer-wall-response'; +export * from './soft-pair-bucket'; +export * from './soft-pair-offerwall'; +export * from './soft-pair-offerwall-response'; +export * from './source'; +export * from './starwall-offer-wall'; +export * from './starwall-offer-wall-response'; +export * from './starwall-plus-block-offer-wall'; +export * from './starwall-plus-block-offer-wall-response'; +export * from './starwall-plus-block-recontact-offer-wall'; +export * from './starwall-plus-block-recontact-offer-wall-response'; +export * from './starwall-plus-offer-wall'; +export * from './starwall-plus-offer-wall-response'; +export * from './statistical-summary-stat'; +export * from './statistical-summary-value'; +export * from './status-code1'; +export * from './status-info-response-fail'; +export * from './status-response'; +export * from './status-response-failure'; +export * from './status-success-fail'; +export * from './tango-cashout-method-data'; +export * from './task-status-response-out'; +export * from './tasks-status-response-out'; +export * from './top-nbucket'; +export * from './top-noffer-wall'; +export * from './top-noffer-wall-response'; +export * from './top-nplus-block-offer-wall'; +export * from './top-nplus-block-offer-wall-response'; +export * from './top-nplus-block-recontact-offer-wall'; +export * from './top-nplus-block-recontact-offer-wall-response'; +export * from './top-nplus-bucket'; +export * from './top-nplus-offer-wall'; +export * from './top-nplus-offer-wall-response'; +export * from './top-nplus-recontact-bucket'; +export * from './upkimportance'; +export * from './usdelivery-address'; +export * from './upk-question'; +export * from './upk-question-choice'; +export * from './upk-question-choice-out'; +export * from './upk-question-configuration-mc'; +export * from './upk-question-configuration-slider'; +export * from './upk-question-configuration-te'; +export * from './upk-question-out'; +export * from './upk-question-response'; +export * from './upk-question-selector-hidden'; +export * from './upk-question-selector-mc'; +export * from './upk-question-selector-slider'; +export * from './upk-question-selector-te'; +export * from './upk-question-type'; +export * from './upk-question-validation'; +export * from './user-info'; +export * from './user-info-response'; +export * from './user-profile-knowledge'; +export * from './user-profile-knowledge-answer'; +export * from './user-question-answer-in'; +export * from './user-transaction-history-response'; +export * from './user-transaction-row'; +export * from './user-wallet-balance'; +export * from './user-wallet-balance-response'; +export * from './user-wallet-config'; +export * from './user-wallet-transaction-type'; +export * from './validation-error'; +export * from './wxetofferwall'; +export * from './wxetofferwall-bucket'; +export * from './wxetofferwall-response'; diff --git a/src/api/models/leaderboard-code.ts b/src/api/models/leaderboard-code.ts new file mode 100644 index 0000000..1fe111a --- /dev/null +++ b/src/api/models/leaderboard-code.ts @@ -0,0 +1,25 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * The type of leaderboard. What the \"values\" represent. + * @export + * @enum {string} + */ +export enum LeaderboardCode { + CompleteCount = 'complete_count', + LargestUserPayout = 'largest_user_payout', + SumUserPayout = 'sum_user_payout' +} + diff --git a/src/api/models/leaderboard-frequency.ts b/src/api/models/leaderboard-frequency.ts new file mode 100644 index 0000000..1570d8c --- /dev/null +++ b/src/api/models/leaderboard-frequency.ts @@ -0,0 +1,25 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * The time period range for the leaderboard. + * @export + * @enum {string} + */ +export enum LeaderboardFrequency { + Daily = 'daily', + Weekly = 'weekly', + Monthly = 'monthly' +} + diff --git a/src/api/models/leaderboard-response.ts b/src/api/models/leaderboard-response.ts new file mode 100644 index 0000000..f121576 --- /dev/null +++ b/src/api/models/leaderboard-response.ts @@ -0,0 +1,45 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { Leaderboard } from './leaderboard'; + /** + * + * + * @export + * @interface LeaderboardResponse + */ +export interface LeaderboardResponse { + + /** + * The status of the API response. + * + * @type {any} + * @memberof LeaderboardResponse + */ + status: any; + + /** + * An optional message, if the status is error. + * + * @type {any} + * @memberof LeaderboardResponse + */ + msg?: any; + + /** + * @type {Leaderboard} + * @memberof LeaderboardResponse + */ + leaderboard: Leaderboard; +} diff --git a/src/api/models/leaderboard-row.ts b/src/api/models/leaderboard-row.ts new file mode 100644 index 0000000..5d51d34 --- /dev/null +++ b/src/api/models/leaderboard-row.ts @@ -0,0 +1,46 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface LeaderboardRow + */ +export interface LeaderboardRow { + + /** + * product_user_id + * + * @type {any} + * @memberof LeaderboardRow + */ + bpuid: any; + + /** + * The numerical data ranks (1 through n) of the values. Ties are ranked using the lowest rank in the group. + * + * @type {any} + * @memberof LeaderboardRow + */ + rank: any; + + /** + * The value. The meaning of the value is dependent on the LeaderboardCode. + * + * @type {any} + * @memberof LeaderboardRow + */ + value: any; +} diff --git a/src/api/models/leaderboard-winner-response.ts b/src/api/models/leaderboard-winner-response.ts new file mode 100644 index 0000000..3919366 --- /dev/null +++ b/src/api/models/leaderboard-winner-response.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface LeaderboardWinnerResponse + */ +export interface LeaderboardWinnerResponse { + + /** + * The status of the API response. + * + * @type {any} + * @memberof LeaderboardWinnerResponse + */ + status: any; + + /** + * An optional message, if the status is error. + * + * @type {any} + * @memberof LeaderboardWinnerResponse + */ + msg?: any; + + /** + * @type {any} + * @memberof LeaderboardWinnerResponse + */ + winners?: any; +} diff --git a/src/api/models/leaderboard-winner.ts b/src/api/models/leaderboard-winner.ts new file mode 100644 index 0000000..912039e --- /dev/null +++ b/src/api/models/leaderboard-winner.ts @@ -0,0 +1,108 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface LeaderboardWinner + */ +export interface LeaderboardWinner { + + /** + * The user's final rank in the leaderboard + * + * @type {any} + * @memberof LeaderboardWinner + */ + rank: any; + + /** + * The time period range for the leaderboard. Allowed values: - __daily__ *(DAILY)*: UTC midnight to UTC midnight - __weekly__ *(WEEKLY)*: Sunday Midnight to Sunday Midnight UTC - __monthly__ *(MONTHLY)*: Jan 1 00:00:00 + * + * @type {any} + * @memberof LeaderboardWinner + */ + freq: any; + + /** + * The type of leaderboard. What the \"values\" represent. Allowed values: - __complete_count__ *(COMPLETE_COUNT)*: Number of Completes - __largest_user_payout__ *(LARGEST_PAYOUT)*: Largest Single Payout - __sum_user_payout__ *(SUM_PAYOUTS)*: (Sum of) Total Payouts + * + * @type {any} + * @memberof LeaderboardWinner + */ + boardCode: any; + + /** + * The country this leaderboard is for. + * + * @type {any} + * @memberof LeaderboardWinner + */ + countryIso: any; + + /** + * When the prize was issued. + * + * @type {any} + * @memberof LeaderboardWinner + */ + issued: any; + + /** + * product_user_id + * + * @type {any} + * @memberof LeaderboardWinner + */ + bpuid: any; + + /** + * @type {any} + * @memberof LeaderboardWinner + */ + description: any; + + /** + * (USD cents) The reward amount + * + * @type {any} + * @memberof LeaderboardWinner + */ + amount: any; + + /** + * The amount as a formatted string in USD. Can be displayed to the user. + * + * @type {any} + * @memberof LeaderboardWinner + */ + amountStr: any; + + /** + * When the leaderboard started + * + * @type {any} + * @memberof LeaderboardWinner + */ + contestStart: any; + + /** + * When the leaderboard ended + * + * @type {any} + * @memberof LeaderboardWinner + */ + contestEnd: any; +} diff --git a/src/api/models/leaderboard.ts b/src/api/models/leaderboard.ts new file mode 100644 index 0000000..7a09b44 --- /dev/null +++ b/src/api/models/leaderboard.ts @@ -0,0 +1,170 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * A leaderboard exists independently for each product_id in each country. Each country is associated with a single timezone. There is a daily, weekly, and monthly leaderboard. + * + * @export + * @interface Leaderboard + */ +export interface Leaderboard { + + /** + * Unique ID for this leaderboard + * + * @type {any} + * @memberof Leaderboard + */ + id: any; + + /** + * Descriptive name for the leaderboard based on the board_code + * + * @type {any} + * @memberof Leaderboard + */ + name: any; + + /** + * The type of leaderboard. What the \"values\" represent. Allowed values: - __complete_count__ *(COMPLETE_COUNT)*: Number of Completes - __largest_user_payout__ *(LARGEST_PAYOUT)*: Largest Single Payout - __sum_user_payout__ *(SUM_PAYOUTS)*: (Sum of) Total Payouts + * + * @type {any} + * @memberof Leaderboard + */ + boardCode: any; + + /** + * product_id + * + * @type {any} + * @memberof Leaderboard + */ + bpid: any; + + /** + * The country this leaderboard is for. + * + * @type {any} + * @memberof Leaderboard + */ + countryIso: any; + + /** + * The time period range for the leaderboard. Allowed values: - __daily__ *(DAILY)*: UTC midnight to UTC midnight - __weekly__ *(WEEKLY)*: Sunday Midnight to Sunday Midnight UTC - __monthly__ *(MONTHLY)*: Jan 1 00:00:00 + * + * @type {any} + * @memberof Leaderboard + */ + freq: any; + + /** + * (unix timestamp) The time it is right now + * + * @type {any} + * @memberof Leaderboard + */ + nowTimestamp: any; + + /** + * The time it is right now (local time, in the leaderboard's timezone). + * + * @type {any} + * @memberof Leaderboard + */ + localTime: any; + + /** + * (unix timestamp) The timestamp of the leaderboard. This is the UTC timestamp of the start of the leaderboard. + * + * @type {any} + * @memberof Leaderboard + */ + timestamp: any; + + /** + * (unix timestamp) The start time of the time range this leaderboard covers. + * + * @type {any} + * @memberof Leaderboard + */ + startTimestamp: any; + + /** + * (unix timestamp) The end time of the time range this leaderboard covers. + * + * @type {any} + * @memberof Leaderboard + */ + endTimestamp: any; + + /** + * The start time of the time range this leaderboard covers (local time, in the leaderboard's timezone). + * + * @type {any} + * @memberof Leaderboard + */ + localStartTime: any; + + /** + * The end time of the time range this leaderboard covers (local time, in the leaderboard's timezone). + * + * @type {any} + * @memberof Leaderboard + */ + localEndTime: any; + + /** + * A formatted string for time range covered by this leaderboard. Can be used to display to users. + * + * @type {any} + * @memberof Leaderboard + */ + startEndStr: any; + + /** + * The timezone for the requested country + * + * @type {any} + * @memberof Leaderboard + */ + timezoneName: any; + + /** + * The UTC offset for the timezone + * + * @type {any} + * @memberof Leaderboard + */ + utcOffset: any; + + /** + * @type {any} + * @memberof Leaderboard + */ + sortOrder?: any; + + /** + * The total number of rows in the leaderboard. + * + * @type {any} + * @memberof Leaderboard + */ + rowCount: any; + + /** + * @type {any} + * @memberof Leaderboard + */ + rows?: any; +} diff --git a/src/api/models/market-profile-knowledge.ts b/src/api/models/market-profile-knowledge.ts new file mode 100644 index 0000000..d30e3fb --- /dev/null +++ b/src/api/models/market-profile-knowledge.ts @@ -0,0 +1,50 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface MarketProfileKnowledge + */ +export interface MarketProfileKnowledge { + + /** + * Name of the source + * + * @type {any} + * @memberof MarketProfileKnowledge + */ + source: any; + + /** + * @type {any} + * @memberof MarketProfileKnowledge + */ + questionId: any; + + /** + * @type {any} + * @memberof MarketProfileKnowledge + */ + answer?: any; + + /** + * When the User submitted this Profiling data + * + * @type {any} + * @memberof MarketProfileKnowledge + */ + created: any; +} diff --git a/src/api/models/marketplace-bucket.ts b/src/api/models/marketplace-bucket.ts new file mode 100644 index 0000000..ce66d3a --- /dev/null +++ b/src/api/models/marketplace-bucket.ts @@ -0,0 +1,104 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { DurationSummary } from './duration-summary'; +import { PayoutSummary } from './payout-summary'; + /** + * + * + * @export + * @interface MarketplaceBucket + */ +export interface MarketplaceBucket { + + /** + * Unique identifier this particular bucket + * + * @type {any} + * @memberof MarketplaceBucket + */ + id: any; + + /** + * The URL to send a respondent into. Must not edit this URL in any way + * + * @type {any} + * @memberof MarketplaceBucket + */ + uri: any; + + /** + * For UI. Provides a dimensionality position for the bucket on the x-axis. + * + * @type {any} + * @memberof MarketplaceBucket + */ + x?: any; + + /** + * For UI. Provides a dimensionality position for the bucket on the y-axis. + * + * @type {any} + * @memberof MarketplaceBucket + */ + y?: any; + + /** + * Currently unused. Will always return empty string + * + * @type {any} + * @memberof MarketplaceBucket + */ + name?: any; + + /** + * Currently unused. Will always return empty string + * + * @type {any} + * @memberof MarketplaceBucket + */ + description?: any; + + /** + * @type {any} + * @memberof MarketplaceBucket + */ + category?: any; + + /** + * @type {any} + * @memberof MarketplaceBucket + */ + contents: any; + + /** + * @type {DurationSummary} + * @memberof MarketplaceBucket + */ + duration: DurationSummary; + + /** + * @type {PayoutSummary} + * @memberof MarketplaceBucket + */ + payout: PayoutSummary; + + /** + * this is the source of the contents + * + * @type {any} + * @memberof MarketplaceBucket + */ + source: any; +} diff --git a/src/api/models/marketplace-inventory-summary.ts b/src/api/models/marketplace-inventory-summary.ts new file mode 100644 index 0000000..e2e6a31 --- /dev/null +++ b/src/api/models/marketplace-inventory-summary.ts @@ -0,0 +1,78 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface MarketplaceInventorySummary + */ +export interface MarketplaceInventorySummary { + + /** + * The count of tasks that are currently live + * + * @type {any} + * @memberof MarketplaceInventorySummary + */ + liveTasks?: any; + + /** + * The count of gen-pop tasks that are currently live + * + * @type {any} + * @memberof MarketplaceInventorySummary + */ + liveGenPopTasks?: any; + + /** + * The count of tasks created + * + * @type {any} + * @memberof MarketplaceInventorySummary + */ + tasksCreated?: any; + + /** + * Number of finishes needed across all live tasks + * + * @type {any} + * @memberof MarketplaceInventorySummary + */ + requiredFinishes?: any; + + /** + * The distribution of payouts for all live tasks + * + * @type {any} + * @memberof MarketplaceInventorySummary + */ + payout?: any; + + /** + * The distribution of expected durations for all live tasks + * + * @type {any} + * @memberof MarketplaceInventorySummary + */ + expectedDuration?: any; + + /** + * The distribution of required finishes on all live tasks + * + * @type {any} + * @memberof MarketplaceInventorySummary + */ + requiredFinishesPerTask?: any; +} diff --git a/src/api/models/marketplace-offerwall-response.ts b/src/api/models/marketplace-offerwall-response.ts new file mode 100644 index 0000000..6c1f90f --- /dev/null +++ b/src/api/models/marketplace-offerwall-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { MarketplaceOfferwall } from './marketplace-offerwall'; +import { OfferWallInfo } from './offer-wall-info'; + /** + * + * + * @export + * @interface MarketplaceOfferwallResponse + */ +export interface MarketplaceOfferwallResponse { + + /** + * @type {OfferWallInfo} + * @memberof MarketplaceOfferwallResponse + */ + info: OfferWallInfo; + + /** + * @type {MarketplaceOfferwall} + * @memberof MarketplaceOfferwallResponse + */ + offerwall: MarketplaceOfferwall; +} diff --git a/src/api/models/marketplace-offerwall.ts b/src/api/models/marketplace-offerwall.ts new file mode 100644 index 0000000..5882ec5 --- /dev/null +++ b/src/api/models/marketplace-offerwall.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Returns buckets grouped by marketplace, one per marketplace, with the tasks ordered by quality. Offerwall code: `5fa23085` + * + * @export + * @interface MarketplaceOfferwall + */ +export interface MarketplaceOfferwall { + + /** + * Unique identifier to reference a generated offerwall + * + * @type {any} + * @memberof MarketplaceOfferwall + */ + id: any; + + /** + * Total opportunities available for specific bpuid respondent and parameters. This value changes frequently and can be used to determine if a respondent has potential tasks available, regardless of the offerwall type being requested. If the value is 0, no buckets will be generated. + * + * @type {any} + * @memberof MarketplaceOfferwall + */ + availabilityCount: any; + + /** + * @type {any} + * @memberof MarketplaceOfferwall + */ + buckets?: any; +} diff --git a/src/api/models/marketplace-summary.ts b/src/api/models/marketplace-summary.ts new file mode 100644 index 0000000..c63fcc0 --- /dev/null +++ b/src/api/models/marketplace-summary.ts @@ -0,0 +1,38 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface MarketplaceSummary + */ +export interface MarketplaceSummary { + + /** + * Inventory of the marketplace + * + * @type {any} + * @memberof MarketplaceSummary + */ + inventory: any; + + /** + * User activity of the marketplace + * + * @type {any} + * @memberof MarketplaceSummary + */ + userActivity?: any; +} diff --git a/src/api/models/offer-wall-info.ts b/src/api/models/offer-wall-info.ts new file mode 100644 index 0000000..84fe2bb --- /dev/null +++ b/src/api/models/offer-wall-info.ts @@ -0,0 +1,28 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface OfferWallInfo + */ +export interface OfferWallInfo { + + /** + * @type {any} + * @memberof OfferWallInfo + */ + success: any; +} diff --git a/src/api/models/one-shot-offerwall-bucket.ts b/src/api/models/one-shot-offerwall-bucket.ts new file mode 100644 index 0000000..d45bd2c --- /dev/null +++ b/src/api/models/one-shot-offerwall-bucket.ts @@ -0,0 +1,54 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface OneShotOfferwallBucket + */ +export interface OneShotOfferwallBucket { + + /** + * Unique identifier this particular bucket + * + * @type {any} + * @memberof OneShotOfferwallBucket + */ + id: any; + + /** + * The URL to send a respondent into. Must not edit this URL in any way + * + * @type {any} + * @memberof OneShotOfferwallBucket + */ + uri: any; + + /** + * The bucket's expected duration, in seconds + * + * @type {any} + * @memberof OneShotOfferwallBucket + */ + duration: any; + + /** + * The bucket's min payout, in usd cents + * + * @type {any} + * @memberof OneShotOfferwallBucket + */ + minPayout: any; +} diff --git a/src/api/models/one-shot-offerwall-response.ts b/src/api/models/one-shot-offerwall-response.ts new file mode 100644 index 0000000..c910578 --- /dev/null +++ b/src/api/models/one-shot-offerwall-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { OfferWallInfo } from './offer-wall-info'; +import { OneShotOfferwall } from './one-shot-offerwall'; + /** + * + * + * @export + * @interface OneShotOfferwallResponse + */ +export interface OneShotOfferwallResponse { + + /** + * @type {OfferWallInfo} + * @memberof OneShotOfferwallResponse + */ + info: OfferWallInfo; + + /** + * @type {OneShotOfferwall} + * @memberof OneShotOfferwallResponse + */ + offerwall: OneShotOfferwall; +} diff --git a/src/api/models/one-shot-offerwall.ts b/src/api/models/one-shot-offerwall.ts new file mode 100644 index 0000000..c2fa921 --- /dev/null +++ b/src/api/models/one-shot-offerwall.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Each bucket has only 1 single task, and only basic info is returned about each bucket. Offerwall code: `6f27b1ae` + * + * @export + * @interface OneShotOfferwall + */ +export interface OneShotOfferwall { + + /** + * Unique identifier to reference a generated offerwall + * + * @type {any} + * @memberof OneShotOfferwall + */ + id: any; + + /** + * Total opportunities available for specific bpuid respondent and parameters. This value changes frequently and can be used to determine if a respondent has potential tasks available, regardless of the offerwall type being requested. If the value is 0, no buckets will be generated. + * + * @type {any} + * @memberof OneShotOfferwall + */ + availabilityCount: any; + + /** + * @type {any} + * @memberof OneShotOfferwall + */ + buckets?: any; +} diff --git a/src/api/models/pattern-validation.ts b/src/api/models/pattern-validation.ts new file mode 100644 index 0000000..2588766 --- /dev/null +++ b/src/api/models/pattern-validation.ts @@ -0,0 +1,38 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface PatternValidation + */ +export interface PatternValidation { + + /** + * Message to display if validation fails + * + * @type {any} + * @memberof PatternValidation + */ + message: any; + + /** + * Regex string to validate. min_length and max_length are checked separately, even if they are part of the regex. + * + * @type {any} + * @memberof PatternValidation + */ + pattern: any; +} diff --git a/src/api/models/payout-status.ts b/src/api/models/payout-status.ts new file mode 100644 index 0000000..d7eb044 --- /dev/null +++ b/src/api/models/payout-status.ts @@ -0,0 +1,28 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * The max size of the db field that holds this value is 20, so please don't add new values longer than that! + * @export + * @enum {string} + */ +export enum PayoutStatus { + PENDING = 'PENDING', + APPROVED = 'APPROVED', + REJECTED = 'REJECTED', + CANCELLED = 'CANCELLED', + FAILED = 'FAILED', + COMPLETE = 'COMPLETE' +} + diff --git a/src/api/models/payout-summary.ts b/src/api/models/payout-summary.ts new file mode 100644 index 0000000..277bca5 --- /dev/null +++ b/src/api/models/payout-summary.ts @@ -0,0 +1,70 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Payouts are in Integer USD Cents + * + * @export + * @interface PayoutSummary + */ +export interface PayoutSummary { + + /** + * @type {any} + * @memberof PayoutSummary + */ + min: any; + + /** + * @type {any} + * @memberof PayoutSummary + */ + max: any; + + /** + * @type {any} + * @memberof PayoutSummary + */ + mean?: any; + + /** + * @type {any} + * @memberof PayoutSummary + */ + q1: any; + + /** + * @type {any} + * @memberof PayoutSummary + */ + q2: any; + + /** + * @type {any} + * @memberof PayoutSummary + */ + q3: any; + + /** + * @type {any} + * @memberof PayoutSummary + */ + lowerWhisker: any; + + /** + * @type {any} + * @memberof PayoutSummary + */ + upperWhisker: any; +} diff --git a/src/api/models/payout-type.ts b/src/api/models/payout-type.ts new file mode 100644 index 0000000..01197e8 --- /dev/null +++ b/src/api/models/payout-type.ts @@ -0,0 +1,31 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * The method in which the requested payout is delivered. + * @export + * @enum {string} + */ +export enum PayoutType { + PAYPAL = 'PAYPAL', + TANGO = 'TANGO', + Dwolla = 'dwolla', + ACH = 'ACH', + CASHINMAIL = 'CASH_IN_MAIL', + PRIZE = 'PRIZE', + AMT = 'AMT', + AmtBonus = 'amt_bonus', + AmtAssignment = 'amt_assignment' +} + diff --git a/src/api/models/paypal-cashout-method-data.ts b/src/api/models/paypal-cashout-method-data.ts new file mode 100644 index 0000000..3f5eaee --- /dev/null +++ b/src/api/models/paypal-cashout-method-data.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface PaypalCashoutMethodData + */ +export interface PaypalCashoutMethodData { + + /** + * @type {any} + * @memberof PaypalCashoutMethodData + */ + type?: any; + + /** + * Email address of the paypal user + * + * @type {any} + * @memberof PaypalCashoutMethodData + */ + email: any; +} diff --git a/src/api/models/profiling-info-response.ts b/src/api/models/profiling-info-response.ts new file mode 100644 index 0000000..91557dc --- /dev/null +++ b/src/api/models/profiling-info-response.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface ProfilingInfoResponse + */ +export interface ProfilingInfoResponse { + + /** + * The status of the API response. + * + * @type {any} + * @memberof ProfilingInfoResponse + */ + status: any; + + /** + * An optional message, if the status is error. + * + * @type {any} + * @memberof ProfilingInfoResponse + */ + msg?: any; + + /** + * @type {any} + * @memberof ProfilingInfoResponse + */ + profilingInfo: any; +} diff --git a/src/api/models/property-type.ts b/src/api/models/property-type.ts new file mode 100644 index 0000000..25c164b --- /dev/null +++ b/src/api/models/property-type.ts @@ -0,0 +1,25 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * + * @export + * @enum {string} + */ +export enum PropertyType { + I = 'i', + N = 'n', + X = 'x' +} + diff --git a/src/api/models/question-info.ts b/src/api/models/question-info.ts new file mode 100644 index 0000000..4cc2548 --- /dev/null +++ b/src/api/models/question-info.ts @@ -0,0 +1,76 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface QuestionInfo + */ +export interface QuestionInfo { + + /** + * @type {any} + * @memberof QuestionInfo + */ + propertyId: any; + + /** + * @type {any} + * @memberof QuestionInfo + */ + propertyLabel: any; + + /** + * Allowed values: - __i__ *(UPK_ITEM)*: UserProfileKnowledge Item - __n__ *(UPK_NUMERICAL)*: UserProfileKnowledge Numerical - __x__ *(UPK_TEXT)*: UserProfileKnowledge Text + * + * @type {any} + * @memberof QuestionInfo + */ + propType?: any; + + /** + * Allowed values: - __*__ *(ZERO_OR_MORE)*: Zero or More - __?__ *(ZERO_OR_ONE)*: Zero or One + * + * @type {any} + * @memberof QuestionInfo + */ + cardinality?: any; + + /** + * @type {any} + * @memberof QuestionInfo + */ + countryIso: any; + + /** + * A Gold-Standard question has been enumerated for all possible values (per country) as best as possible by GRL,allowing it to be mapped across inventory sources. A property not marked as Gold-Standard may have: 1) marketplace qid associations & 2) category associations, but doesn't have a defined 'range' (list of allowed itemsin a multiple choice question). This is used for exposing a user's profiling data & forthe Nudge API. + * + * @type {any} + * @memberof QuestionInfo + */ + goldStandard?: any; + + /** + * @type {any} + * @memberof QuestionInfo + */ + options?: any; + + /** + * @type {any} + * @memberof QuestionInfo + */ + category: any; +} diff --git a/src/api/models/question-option.ts b/src/api/models/question-option.ts new file mode 100644 index 0000000..06fadea --- /dev/null +++ b/src/api/models/question-option.ts @@ -0,0 +1,34 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface QuestionOption + */ +export interface QuestionOption { + + /** + * @type {any} + * @memberof QuestionOption + */ + id: any; + + /** + * @type {any} + * @memberof QuestionOption + */ + label: any; +} diff --git a/src/api/models/redemption-currency.ts b/src/api/models/redemption-currency.ts new file mode 100644 index 0000000..1f21f49 --- /dev/null +++ b/src/api/models/redemption-currency.ts @@ -0,0 +1,32 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * Supported Currencies for Foreign Redemptions + * @export + * @enum {string} + */ +export enum RedemptionCurrency { + USD = 'USD', + CAD = 'CAD', + GBP = 'GBP', + EUR = 'EUR', + INR = 'INR', + AUD = 'AUD', + PLN = 'PLN', + SEK = 'SEK', + SGD = 'SGD', + MXN = 'MXN' +} + diff --git a/src/api/models/report-task.ts b/src/api/models/report-task.ts new file mode 100644 index 0000000..de67811 --- /dev/null +++ b/src/api/models/report-task.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface ReportTask + */ +export interface ReportTask { + + /** + * The unique identifier for the user, which is set by the Supplier. + * + * @type {any} + * @memberof ReportTask + */ + bpuid: any; + + /** + * The reason a user reported a task. Allowed values: - __0__ *(REASON_UNKNOWN)*: Used to indicate the user exited the task without giving feedback - __1__ *(TECHNICAL_ERROR)*: Task is in the wrong language/country, unanswerable question, won't proceed to next question, loading forever, error message - __2__ *(NO_REDIRECT)*: Task ended (completed or failed, and showed the user some dialog indicating the task was over), but failed to redirect - __3__ *(PRIVACY_INVASION)*: Asked for full name, home address, identity on another site, cc - __4__ *(UNCOMFORTABLE_TOPICS)*: Asked about children, employer, medical issues, drug use, STDs, etc. - __5__ *(ASKED_FOR_NOT_ALLOWED_ACTION)*: Asked to install software, signup/login to external site, access webcam, promise to pay using external site, etc. - __6__ *(BAD_ON_MOBILE)*: Task doesn't work well on a mobile device - __7__ *(DIDNT_LIKE)*: Too long, too boring, confusing, complicated, too many open-ended/free-response questions + * + * @type {any} + * @memberof ReportTask + */ + reasons?: any; + + /** + * @type {any} + * @memberof ReportTask + */ + notes?: any; +} diff --git a/src/api/models/report-value.ts b/src/api/models/report-value.ts new file mode 100644 index 0000000..af4fbfb --- /dev/null +++ b/src/api/models/report-value.ts @@ -0,0 +1,30 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * The reason a user reported a task. + * @export + * @enum {string} + */ +export enum ReportValue { + _0 = '0', + _1 = '1', + _2 = '2', + _3 = '3', + _4 = '4', + _5 = '5', + _6 = '6', + _7 = '7' +} + diff --git a/src/api/models/session-adjusted-status.ts b/src/api/models/session-adjusted-status.ts new file mode 100644 index 0000000..95e4bc9 --- /dev/null +++ b/src/api/models/session-adjusted-status.ts @@ -0,0 +1,25 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * An adjusted_status is set if a session is adjusted by the marketplace after the original return. A session can be adjusted multiple times. This is the most recent status. If a session was originally a complete, was adjusted to incomplete, then back to complete, the adjusted_status will be None, but the adjusted_timestamp will be set to the most recent change. + * @export + * @enum {string} + */ +export enum SessionAdjustedStatus { + Ac = 'ac', + Af = 'af', + Pa = 'pa' +} + diff --git a/src/api/models/session-status-code2.ts b/src/api/models/session-status-code2.ts new file mode 100644 index 0000000..3fd7025 --- /dev/null +++ b/src/api/models/session-status-code2.ts @@ -0,0 +1,35 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * __Status Detail__ This should be set if the Session.status_code_1 is SESSION_XXX_FAIL + * @export + * @enum {string} + */ +export enum SessionStatusCode2 { + _1 = '1', + _2 = '2', + _3 = '3', + _4 = '4', + _5 = '5', + _6 = '6', + _7 = '7', + _8 = '8', + _9 = '9', + _10 = '10', + _11 = '11', + _12 = '12', + _13 = '13' +} + diff --git a/src/api/models/single-entry-bucket.ts b/src/api/models/single-entry-bucket.ts new file mode 100644 index 0000000..a00c96d --- /dev/null +++ b/src/api/models/single-entry-bucket.ts @@ -0,0 +1,38 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface SingleEntryBucket + */ +export interface SingleEntryBucket { + + /** + * Unique identifier this particular bucket + * + * @type {any} + * @memberof SingleEntryBucket + */ + id: any; + + /** + * The URL to send a respondent into. Must not edit this URL in any way + * + * @type {any} + * @memberof SingleEntryBucket + */ + uri: any; +} diff --git a/src/api/models/single-entry-offer-wall-response.ts b/src/api/models/single-entry-offer-wall-response.ts new file mode 100644 index 0000000..4d77d21 --- /dev/null +++ b/src/api/models/single-entry-offer-wall-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { OfferWallInfo } from './offer-wall-info'; +import { SingleEntryOfferWall } from './single-entry-offer-wall'; + /** + * + * + * @export + * @interface SingleEntryOfferWallResponse + */ +export interface SingleEntryOfferWallResponse { + + /** + * @type {OfferWallInfo} + * @memberof SingleEntryOfferWallResponse + */ + info: OfferWallInfo; + + /** + * @type {SingleEntryOfferWall} + * @memberof SingleEntryOfferWallResponse + */ + offerwall: SingleEntryOfferWall; +} diff --git a/src/api/models/single-entry-offer-wall.ts b/src/api/models/single-entry-offer-wall.ts new file mode 100644 index 0000000..6e1b90e --- /dev/null +++ b/src/api/models/single-entry-offer-wall.ts @@ -0,0 +1,52 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Only returns a single bucket with the top scoring tasks. Offerwall code: `5fl8bpv5` + * + * @export + * @interface SingleEntryOfferWall + */ +export interface SingleEntryOfferWall { + + /** + * Unique identifier to reference a generated offerwall + * + * @type {any} + * @memberof SingleEntryOfferWall + */ + id: any; + + /** + * Total opportunities available for specific bpuid respondent and parameters. This value changes frequently and can be used to determine if a respondent has potential tasks available, regardless of the offerwall type being requested. If the value is 0, no buckets will be generated. + * + * @type {any} + * @memberof SingleEntryOfferWall + */ + availabilityCount: any; + + /** + * @type {any} + * @memberof SingleEntryOfferWall + */ + buckets?: any; + + /** + * The format describing the str representation of a payout. Typically, this would be displayed to a user. The payout_format is similar to python format string with a subset of functionality supported. Only float with a precision are supported along with an optional comma for a thousands separator. In addition, a mathematical operator can be applied, such as dividing by 100. Examples are shown assuming payout = 100 (one dollar). - \"{payout*10:,.0f} Points\" -> \"1,000 Points\" - \"${payout/100:.2f}\" -> \"$1.00\" + * + * @type {any} + * @memberof SingleEntryOfferWall + */ + payoutFormat: any; +} diff --git a/src/api/models/soft-pair-bucket.ts b/src/api/models/soft-pair-bucket.ts new file mode 100644 index 0000000..f794141 --- /dev/null +++ b/src/api/models/soft-pair-bucket.ts @@ -0,0 +1,78 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface SoftPairBucket + */ +export interface SoftPairBucket { + + /** + * Unique identifier this particular bucket + * + * @type {any} + * @memberof SoftPairBucket + */ + id: any; + + /** + * The URL to send a respondent into. Must not edit this URL in any way. If the eligibility is conditional or ineligible, the uri will be null. + * + * @type {any} + * @memberof SoftPairBucket + */ + uri: any; + + /** + * @type {any} + * @memberof SoftPairBucket + */ + category?: any; + + /** + * @type {any} + * @memberof SoftPairBucket + */ + contents: any; + + /** + * @type {any} + * @memberof SoftPairBucket + */ + eligibility: any; + + /** + * @type {any} + * @memberof SoftPairBucket + */ + missingQuestions?: any; + + /** + * this is the max loi of the contents + * + * @type {any} + * @memberof SoftPairBucket + */ + loi: any; + + /** + * this is the min payout of the contents + * + * @type {any} + * @memberof SoftPairBucket + */ + payout: any; +} diff --git a/src/api/models/soft-pair-offerwall-response.ts b/src/api/models/soft-pair-offerwall-response.ts new file mode 100644 index 0000000..6b33edd --- /dev/null +++ b/src/api/models/soft-pair-offerwall-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { OfferWallInfo } from './offer-wall-info'; +import { SoftPairOfferwall } from './soft-pair-offerwall'; + /** + * + * + * @export + * @interface SoftPairOfferwallResponse + */ +export interface SoftPairOfferwallResponse { + + /** + * @type {OfferWallInfo} + * @memberof SoftPairOfferwallResponse + */ + info: OfferWallInfo; + + /** + * @type {SoftPairOfferwall} + * @memberof SoftPairOfferwallResponse + */ + offerwall: SoftPairOfferwall; +} diff --git a/src/api/models/soft-pair-offerwall.ts b/src/api/models/soft-pair-offerwall.ts new file mode 100644 index 0000000..a15b3b8 --- /dev/null +++ b/src/api/models/soft-pair-offerwall.ts @@ -0,0 +1,50 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * This offerwall contains tasks for which the user has a conditional eligibility. The questions that a user must answer to determine the eligibility are included within each bucket. Additionally, the question definitions are included for convenience. Offerwall code: `37d1da64` + * + * @export + * @interface SoftPairOfferwall + */ +export interface SoftPairOfferwall { + + /** + * Unique identifier to reference a generated offerwall + * + * @type {any} + * @memberof SoftPairOfferwall + */ + id: any; + + /** + * Total opportunities available for specific bpuid respondent and parameters. This value changes frequently and can be used to determine if a respondent has potential tasks available, regardless of the offerwall type being requested. If the value is 0, no buckets will be generated. + * + * @type {any} + * @memberof SoftPairOfferwall + */ + availabilityCount: any; + + /** + * @type {any} + * @memberof SoftPairOfferwall + */ + buckets?: any; + + /** + * @type {any} + * @memberof SoftPairOfferwall + */ + questionInfo?: any; +} diff --git a/src/api/models/source.ts b/src/api/models/source.ts new file mode 100644 index 0000000..9c0d1d9 --- /dev/null +++ b/src/api/models/source.ts @@ -0,0 +1,43 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * + * @export + * @enum {string} + */ +export enum Source { + G = 'g', + C = 'c', + A = 'a', + D = 'd', + Et = 'et', + F = 'f', + I = 'i', + L = 'l', + M = 'm', + N = 'n', + O = 'o', + E = 'e', + R = 'r', + Pr = 'pr', + P = 'p', + Rd = 'rd', + H = 'h', + S = 's', + T = 't', + U = 'u', + W = 'w' +} + diff --git a/src/api/models/starwall-offer-wall-response.ts b/src/api/models/starwall-offer-wall-response.ts new file mode 100644 index 0000000..bdf3712 --- /dev/null +++ b/src/api/models/starwall-offer-wall-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { OfferWallInfo } from './offer-wall-info'; +import { StarwallOfferWall } from './starwall-offer-wall'; + /** + * + * + * @export + * @interface StarwallOfferWallResponse + */ +export interface StarwallOfferWallResponse { + + /** + * @type {OfferWallInfo} + * @memberof StarwallOfferWallResponse + */ + info: OfferWallInfo; + + /** + * @type {StarwallOfferWall} + * @memberof StarwallOfferWallResponse + */ + offerwall: StarwallOfferWall; +} diff --git a/src/api/models/starwall-offer-wall.ts b/src/api/models/starwall-offer-wall.ts new file mode 100644 index 0000000..2eaaef3 --- /dev/null +++ b/src/api/models/starwall-offer-wall.ts @@ -0,0 +1,52 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * An offerwall with buckets that are clustered by setting as seeds the highest scoring surveys for each bin, then the rest are distributed according to their Euclidean distance using the bucket's features. Offerwall code: `b59a2d2b` + * + * @export + * @interface StarwallOfferWall + */ +export interface StarwallOfferWall { + + /** + * Unique identifier to reference a generated offerwall + * + * @type {any} + * @memberof StarwallOfferWall + */ + id: any; + + /** + * Total opportunities available for specific bpuid respondent and parameters. This value changes frequently and can be used to determine if a respondent has potential tasks available, regardless of the offerwall type being requested. If the value is 0, no buckets will be generated. + * + * @type {any} + * @memberof StarwallOfferWall + */ + availabilityCount: any; + + /** + * @type {any} + * @memberof StarwallOfferWall + */ + buckets?: any; + + /** + * The format describing the str representation of a payout. Typically, this would be displayed to a user. The payout_format is similar to python format string with a subset of functionality supported. Only float with a precision are supported along with an optional comma for a thousands separator. In addition, a mathematical operator can be applied, such as dividing by 100. Examples are shown assuming payout = 100 (one dollar). - \"{payout*10:,.0f} Points\" -> \"1,000 Points\" - \"${payout/100:.2f}\" -> \"$1.00\" + * + * @type {any} + * @memberof StarwallOfferWall + */ + payoutFormat: any; +} diff --git a/src/api/models/starwall-plus-block-offer-wall-response.ts b/src/api/models/starwall-plus-block-offer-wall-response.ts new file mode 100644 index 0000000..e166895 --- /dev/null +++ b/src/api/models/starwall-plus-block-offer-wall-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { OfferWallInfo } from './offer-wall-info'; +import { StarwallPlusBlockOfferWall } from './starwall-plus-block-offer-wall'; + /** + * + * + * @export + * @interface StarwallPlusBlockOfferWallResponse + */ +export interface StarwallPlusBlockOfferWallResponse { + + /** + * @type {OfferWallInfo} + * @memberof StarwallPlusBlockOfferWallResponse + */ + info: OfferWallInfo; + + /** + * @type {StarwallPlusBlockOfferWall} + * @memberof StarwallPlusBlockOfferWallResponse + */ + offerwall: StarwallPlusBlockOfferWall; +} diff --git a/src/api/models/starwall-plus-block-offer-wall.ts b/src/api/models/starwall-plus-block-offer-wall.ts new file mode 100644 index 0000000..956c49a --- /dev/null +++ b/src/api/models/starwall-plus-block-offer-wall.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Same as the StarwallOfferWall, but the buckets include contents and no buckets are returned if the user is blocked. Offerwall code: `7fa1b3f4` + * + * @export + * @interface StarwallPlusBlockOfferWall + */ +export interface StarwallPlusBlockOfferWall { + + /** + * Unique identifier to reference a generated offerwall + * + * @type {any} + * @memberof StarwallPlusBlockOfferWall + */ + id: any; + + /** + * Total opportunities available for specific bpuid respondent and parameters. This value changes frequently and can be used to determine if a respondent has potential tasks available, regardless of the offerwall type being requested. If the value is 0, no buckets will be generated. + * + * @type {any} + * @memberof StarwallPlusBlockOfferWall + */ + availabilityCount: any; + + /** + * @type {any} + * @memberof StarwallPlusBlockOfferWall + */ + buckets?: any; +} diff --git a/src/api/models/starwall-plus-block-recontact-offer-wall-response.ts b/src/api/models/starwall-plus-block-recontact-offer-wall-response.ts new file mode 100644 index 0000000..7f51a2f --- /dev/null +++ b/src/api/models/starwall-plus-block-recontact-offer-wall-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { OfferWallInfo } from './offer-wall-info'; +import { StarwallPlusBlockRecontactOfferWall } from './starwall-plus-block-recontact-offer-wall'; + /** + * + * + * @export + * @interface StarwallPlusBlockRecontactOfferWallResponse + */ +export interface StarwallPlusBlockRecontactOfferWallResponse { + + /** + * @type {OfferWallInfo} + * @memberof StarwallPlusBlockRecontactOfferWallResponse + */ + info: OfferWallInfo; + + /** + * @type {StarwallPlusBlockRecontactOfferWall} + * @memberof StarwallPlusBlockRecontactOfferWallResponse + */ + offerwall: StarwallPlusBlockRecontactOfferWall; +} diff --git a/src/api/models/starwall-plus-block-recontact-offer-wall.ts b/src/api/models/starwall-plus-block-recontact-offer-wall.ts new file mode 100644 index 0000000..b1a400b --- /dev/null +++ b/src/api/models/starwall-plus-block-recontact-offer-wall.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Same as the StarwallOfferWall, but the buckets include contents, no buckets are returned if the user is blocked, and each bucket includes a recontact key. Offerwall code: `630db2a4` + * + * @export + * @interface StarwallPlusBlockRecontactOfferWall + */ +export interface StarwallPlusBlockRecontactOfferWall { + + /** + * Unique identifier to reference a generated offerwall + * + * @type {any} + * @memberof StarwallPlusBlockRecontactOfferWall + */ + id: any; + + /** + * Total opportunities available for specific bpuid respondent and parameters. This value changes frequently and can be used to determine if a respondent has potential tasks available, regardless of the offerwall type being requested. If the value is 0, no buckets will be generated. + * + * @type {any} + * @memberof StarwallPlusBlockRecontactOfferWall + */ + availabilityCount: any; + + /** + * @type {any} + * @memberof StarwallPlusBlockRecontactOfferWall + */ + buckets?: any; +} diff --git a/src/api/models/starwall-plus-offer-wall-response.ts b/src/api/models/starwall-plus-offer-wall-response.ts new file mode 100644 index 0000000..55b97cf --- /dev/null +++ b/src/api/models/starwall-plus-offer-wall-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { OfferWallInfo } from './offer-wall-info'; +import { StarwallPlusOfferWall } from './starwall-plus-offer-wall'; + /** + * + * + * @export + * @interface StarwallPlusOfferWallResponse + */ +export interface StarwallPlusOfferWallResponse { + + /** + * @type {OfferWallInfo} + * @memberof StarwallPlusOfferWallResponse + */ + info: OfferWallInfo; + + /** + * @type {StarwallPlusOfferWall} + * @memberof StarwallPlusOfferWallResponse + */ + offerwall: StarwallPlusOfferWall; +} diff --git a/src/api/models/starwall-plus-offer-wall.ts b/src/api/models/starwall-plus-offer-wall.ts new file mode 100644 index 0000000..dc94f77 --- /dev/null +++ b/src/api/models/starwall-plus-offer-wall.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Same as the StarwallOfferWall, but the buckets include contents. Offerwall code: `5481f322` + * + * @export + * @interface StarwallPlusOfferWall + */ +export interface StarwallPlusOfferWall { + + /** + * Unique identifier to reference a generated offerwall + * + * @type {any} + * @memberof StarwallPlusOfferWall + */ + id: any; + + /** + * Total opportunities available for specific bpuid respondent and parameters. This value changes frequently and can be used to determine if a respondent has potential tasks available, regardless of the offerwall type being requested. If the value is 0, no buckets will be generated. + * + * @type {any} + * @memberof StarwallPlusOfferWall + */ + availabilityCount: any; + + /** + * @type {any} + * @memberof StarwallPlusOfferWall + */ + buckets?: any; +} diff --git a/src/api/models/statistical-summary-stat.ts b/src/api/models/statistical-summary-stat.ts new file mode 100644 index 0000000..51f5167 --- /dev/null +++ b/src/api/models/statistical-summary-stat.ts @@ -0,0 +1,38 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface StatisticalSummaryStat + */ +export interface StatisticalSummaryStat { + + /** + * The grouping criteria + * + * @type {any} + * @memberof StatisticalSummaryStat + */ + facet: any; + + /** + * Statistical Summary for the given metric and facet + * + * @type {any} + * @memberof StatisticalSummaryStat + */ + value: any; +} diff --git a/src/api/models/statistical-summary-value.ts b/src/api/models/statistical-summary-value.ts new file mode 100644 index 0000000..d89df72 --- /dev/null +++ b/src/api/models/statistical-summary-value.ts @@ -0,0 +1,72 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface StatisticalSummaryValue + */ +export interface StatisticalSummaryValue { + + /** + * @type {any} + * @memberof StatisticalSummaryValue + */ + min: any; + + /** + * @type {any} + * @memberof StatisticalSummaryValue + */ + max: any; + + /** + * @type {any} + * @memberof StatisticalSummaryValue + */ + mean: any; + + /** + * @type {any} + * @memberof StatisticalSummaryValue + */ + q1: any; + + /** + * equal to the median + * + * @type {any} + * @memberof StatisticalSummaryValue + */ + q2: any; + + /** + * @type {any} + * @memberof StatisticalSummaryValue + */ + q3: any; + + /** + * @type {any} + * @memberof StatisticalSummaryValue + */ + lowerWhisker: any; + + /** + * @type {any} + * @memberof StatisticalSummaryValue + */ + upperWhisker: any; +} diff --git a/src/api/models/status-code1.ts b/src/api/models/status-code1.ts new file mode 100644 index 0000000..3023cda --- /dev/null +++ b/src/api/models/status-code1.ts @@ -0,0 +1,41 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * __High level status code for outcome of the session.__ This should only be NULL if the Status is ABANDON or TIMEOUT + * @export + * @enum {string} + */ +export enum StatusCode1 { + _1 = '1', + _2 = '2', + _3 = '3', + _4 = '4', + _5 = '5', + _6 = '6', + _7 = '7', + _8 = '8', + _9 = '9', + _10 = '10', + _11 = '11', + _12 = '12', + _13 = '13', + _14 = '14', + _15 = '15', + _16 = '16', + _17 = '17', + _18 = '18', + _19 = '19' +} + diff --git a/src/api/models/status-info-response-fail.ts b/src/api/models/status-info-response-fail.ts new file mode 100644 index 0000000..16bfd2c --- /dev/null +++ b/src/api/models/status-info-response-fail.ts @@ -0,0 +1,37 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { StatusSuccessFail } from './status-success-fail'; + /** + * + * + * @export + * @interface StatusInfoResponseFail + */ +export interface StatusInfoResponseFail { + + /** + * @type {StatusSuccessFail} + * @memberof StatusInfoResponseFail + */ + info: StatusSuccessFail; + + /** + * An optional message, if success is False + * + * @type {any} + * @memberof StatusInfoResponseFail + */ + msg: any; +} diff --git a/src/api/models/status-response-failure.ts b/src/api/models/status-response-failure.ts new file mode 100644 index 0000000..4ed5347 --- /dev/null +++ b/src/api/models/status-response-failure.ts @@ -0,0 +1,38 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface StatusResponseFailure + */ +export interface StatusResponseFailure { + + /** + * The status of the API response. + * + * @type {any} + * @memberof StatusResponseFailure + */ + status: any; + + /** + * An optional message, if the status is failure. + * + * @type {any} + * @memberof StatusResponseFailure + */ + msg: any; +} diff --git a/src/api/models/status-response.ts b/src/api/models/status-response.ts new file mode 100644 index 0000000..c7d5b89 --- /dev/null +++ b/src/api/models/status-response.ts @@ -0,0 +1,38 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface StatusResponse + */ +export interface StatusResponse { + + /** + * The status of the API response. + * + * @type {any} + * @memberof StatusResponse + */ + status: any; + + /** + * An optional message, if the status is error. + * + * @type {any} + * @memberof StatusResponse + */ + msg?: any; +} diff --git a/src/api/models/status-success-fail.ts b/src/api/models/status-success-fail.ts new file mode 100644 index 0000000..cd78611 --- /dev/null +++ b/src/api/models/status-success-fail.ts @@ -0,0 +1,30 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface StatusSuccessFail + */ +export interface StatusSuccessFail { + + /** + * Whether the API response is successful. + * + * @type {any} + * @memberof StatusSuccessFail + */ + success?: any; +} diff --git a/src/api/models/tango-cashout-method-data.ts b/src/api/models/tango-cashout-method-data.ts new file mode 100644 index 0000000..1096235 --- /dev/null +++ b/src/api/models/tango-cashout-method-data.ts @@ -0,0 +1,48 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface TangoCashoutMethodData + */ +export interface TangoCashoutMethodData { + + /** + * @type {any} + * @memberof TangoCashoutMethodData + */ + type?: any; + + /** + * tango utid + * + * @type {any} + * @memberof TangoCashoutMethodData + */ + utid: any; + + /** + * @type {any} + * @memberof TangoCashoutMethodData + */ + countries: any; + + /** + * @type {any} + * @memberof TangoCashoutMethodData + */ + valueType: any; +} diff --git a/src/api/models/task-status-response-out.ts b/src/api/models/task-status-response-out.ts new file mode 100644 index 0000000..a4a759d --- /dev/null +++ b/src/api/models/task-status-response-out.ts @@ -0,0 +1,186 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Used in the Task Status API call when queried using a TSID (task status ID) Note: the api response is a little different from the internal representation b/c: - Include some old stuff: \"currency\": \"USD\", \"final_status\": 0, - status_code_1 and status_code_2 use the enum NAME, not the value - The status is the grpc's enum value, NOT the pydantic's - payout, user_payout, and user_payout_string are not Nullable - payout_format is null on list statuses + * + * @export + * @interface TaskStatusResponseOut + */ +export interface TaskStatusResponseOut { + + /** + * A unique identifier for the session + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + tsid: any; + + /** + * The BP ID of the associated respondent + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + productId: any; + + /** + * A unique identifier for each user, which is set by the Supplier + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + productUserId: any; + + /** + * When the session was started + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + started: any; + + /** + * When the session was finished + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + finished?: any; + + /** + * The outcome of a session. - 0 - UNKNOWN - 1 - ENTER (the user has not yet returned) - 2 - INCOMPLETE (the user failed) - 3 - COMPLETE (the user completed the task) + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + status?: any; + + /** + * The amount paid to the supplier, in integer USD cents + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + payout?: any; + + /** + * If a payout transformation is configured on this account, this is the amount the user should earn, in integer USD cents + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + userPayout?: any; + + /** + * The format describing the str representation of a payout. Typically, this would be displayed to a user. The payout_format is similar to python format string with a subset of functionality supported. Only float with a precision are supported along with an optional comma for a thousands separator. In addition, a mathematical operator can be applied, such as dividing by 100. Examples are shown assuming payout = 100 (one dollar). - \"{payout*10:,.0f} Points\" -> \"1,000 Points\" - \"${payout/100:.2f}\" -> \"$1.00\" + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + payoutFormat?: any; + + /** + * If a payout transformation is configured on this account, this is the amount to display to the user + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + userPayoutString?: any; + + /** + * Any extra url params used in the offerwall request will be passed back here + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + kwargs?: any; + + /** + * __High level status code for outcome of the session.__ This should only be NULL if the Status is ABANDON or TIMEOUT Allowed values: - __BUYER_FAIL__: User terminated in buyer survey - __BUYER_QUALITY_FAIL__: User terminated in buyer survey for quality reasons - __PS_FAIL__: User failed in marketplace's prescreener - __PS_QUALITY__: User rejected by marketplace for quality reasons - __PS_BLOCKED__: User is explicitly blocked by the marketplace. Note: on some marketplaces, users can have multiple PS_QUALITY terminations and still complete surveys. - __PS_OVERQUOTA__: User rejected by marketplace for over quota - __PS_DUPLICATE__: User rejected by marketplace for duplicate - __GRS_FAIL__: The user failed within the GRS Platform - __GRS_QUALITY_FAIL__: The user failed within the GRS Platform for quality reasons - __GRS_ABANDON__: The user abandoned/timed out within the GRS Platform - __PS_ABANDON__: The user abandoned/timed out within the marketplace's pre-screen system. Note: On most marketplaces, we have no way of distinguishing between this and BUYER_ABANDON. BUYER_ABANDON is used as the default, unless we know it is PS_ABANDON. - __BUYER_ABANDON__: The user abandoned/timed out within the client survey - __UNKNOWN__: The status code is not documented - __COMPLETE__: The user completed the task successfully - __MARKETPLACE_FAIL__: Something was wrong upon the user redirecting from the marketplace, e.g. no postback received, or url hashing failures. - __SESSION_START_FAIL__: User failed before being sent into a marketplace - __SESSION_CONTINUE_FAIL__: User failed between attempts - __SESSION_START_QUALITY_FAIL__: User failed before being sent into a marketplace for \"security\" reasons - __SESSION_CONTINUE_QUALITY_FAIL__: User failed between attempts for \"security\" reasons + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + statusCode1?: any; + + /** + * __Status Detail__ This should be set if the Session.status_code_1 is SESSION_XXX_FAIL Allowed values: - __ENTRY_URL_MODIFICATION__: Unable to parse either the bucket_id, request_id, or nudge_id from the url - __UNRECOGNIZED_IP__: The client's IP failed maxmind lookup, or we failed to store it for some reason - __USER_IS_ANONYMOUS__: User is using an anonymous IP - __USER_IS_BLOCKED__: User is blocked - __USER_IS_RATE_LIMITED__: User is rate limited - __UNRECOGNIZED_DEVICE__: The client's useragent was not categorized as desktop, mobile, or tablet - __OFFERWALL_EXPIRED__: The user clicked after 5 min - __INTERNAL_ERROR__: Something unexpected happened - __OFFERWALL_COUNTRY_MISMATCH__: The user requested the offerwall for a different country than their IP address indicates - __INVALID_BUCKET_ID__: The bucket id indicated in the url does not exist. This is likely due to the user clicking on a bucket for an offerwall that has already been refreshed. - __NO_TASKS_AVAILABLE__: Not necessarily the user's fault. We thought we had surveys, but due to for e.g. the user entering on a different device than we thought, there really are none. If we get a lot of these, then that might indicate something is wrong. - __ATTEMPT_IS_SUSPICIOUS__: The entrance attempt was flagged by GRLIQ as suspicious - __GRLIQ_MISSING__: No GRLIQ forensics post was received + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + statusCode2?: any; + + /** + * An adjusted_status is set if a session is adjusted by the marketplace after the original return. A session can be adjusted multiple times. This is the most recent status. If a session was originally a complete, was adjusted to incomplete, then back to complete, the adjusted_status will be None, but the adjusted_timestamp will be set to the most recent change. Allowed values: - __ac__ *(ADJUSTED_TO_COMPLETE)*: Task was reconciled to complete - __af__ *(ADJUSTED_TO_FAIL)*: Task was reconciled to incomplete - __pa__ *(PAYOUT_ADJUSTMENT)*: The payout was changed. This applies to Sessions ONLY. + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + adjustedStatus?: any; + + /** + * When the adjusted status was last set. + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + adjustedTimestamp?: any; + + /** + * The new payout after adjustment. + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + adjustedPayout?: any; + + /** + * The new user_payout after adjustment. + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + adjustedUserPayout?: any; + + /** + * The new user_payout_string after adjustment. + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + adjustedUserPayoutString?: any; + + /** + * @type {any} + * @memberof TaskStatusResponseOut + */ + currency?: any; + + /** + * This is deprecated + * + * @type {any} + * @memberof TaskStatusResponseOut + */ + finalStatus?: any; + + /** + * @type {any} + * @memberof TaskStatusResponseOut + */ + bpuid: any; +} diff --git a/src/api/models/tasks-status-response-out.ts b/src/api/models/tasks-status-response-out.ts new file mode 100644 index 0000000..2ec1440 --- /dev/null +++ b/src/api/models/tasks-status-response-out.ts @@ -0,0 +1,28 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface TasksStatusResponseOut + */ +export interface TasksStatusResponseOut { + + /** + * @type {any} + * @memberof TasksStatusResponseOut + */ + tasksStatus?: any; +} diff --git a/src/api/models/top-nbucket.ts b/src/api/models/top-nbucket.ts new file mode 100644 index 0000000..51ca65f --- /dev/null +++ b/src/api/models/top-nbucket.ts @@ -0,0 +1,98 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { DurationSummary } from './duration-summary'; +import { PayoutSummary } from './payout-summary'; + /** + * + * + * @export + * @interface TopNBucket + */ +export interface TopNBucket { + + /** + * Unique identifier this particular bucket + * + * @type {any} + * @memberof TopNBucket + */ + id: any; + + /** + * The URL to send a respondent into. Must not edit this URL in any way + * + * @type {any} + * @memberof TopNBucket + */ + uri: any; + + /** + * For UI. Provides a dimensionality position for the bucket on the x-axis. + * + * @type {any} + * @memberof TopNBucket + */ + x?: any; + + /** + * For UI. Provides a dimensionality position for the bucket on the y-axis. + * + * @type {any} + * @memberof TopNBucket + */ + y?: any; + + /** + * Currently unused. Will always return empty string + * + * @type {any} + * @memberof TopNBucket + */ + name?: any; + + /** + * Currently unused. Will always return empty string + * + * @type {any} + * @memberof TopNBucket + */ + description?: any; + + /** + * @type {any} + * @memberof TopNBucket + */ + category?: any; + + /** + * @type {DurationSummary} + * @memberof TopNBucket + */ + duration: DurationSummary; + + /** + * @type {PayoutSummary} + * @memberof TopNBucket + */ + payout: PayoutSummary; + + /** + * A proprietary score to determine the overall quality of the tasks that are within the bucket. Higher is better. + * + * @type {any} + * @memberof TopNBucket + */ + qualityScore: any; +} diff --git a/src/api/models/top-noffer-wall-response.ts b/src/api/models/top-noffer-wall-response.ts new file mode 100644 index 0000000..24d6b10 --- /dev/null +++ b/src/api/models/top-noffer-wall-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { OfferWallInfo } from './offer-wall-info'; +import { TopNOfferWall } from './top-noffer-wall'; + /** + * + * + * @export + * @interface TopNOfferWallResponse + */ +export interface TopNOfferWallResponse { + + /** + * @type {OfferWallInfo} + * @memberof TopNOfferWallResponse + */ + info: OfferWallInfo; + + /** + * @type {TopNOfferWall} + * @memberof TopNOfferWallResponse + */ + offerwall: TopNOfferWall; +} diff --git a/src/api/models/top-noffer-wall.ts b/src/api/models/top-noffer-wall.ts new file mode 100644 index 0000000..7e4b6a4 --- /dev/null +++ b/src/api/models/top-noffer-wall.ts @@ -0,0 +1,52 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * An offerwall with buckets that are clustered by the `split_by` argument using KMeans clustering. Offerwall code: `45b7228a7` + * + * @export + * @interface TopNOfferWall + */ +export interface TopNOfferWall { + + /** + * Unique identifier to reference a generated offerwall + * + * @type {any} + * @memberof TopNOfferWall + */ + id: any; + + /** + * Total opportunities available for specific bpuid respondent and parameters. This value changes frequently and can be used to determine if a respondent has potential tasks available, regardless of the offerwall type being requested. If the value is 0, no buckets will be generated. + * + * @type {any} + * @memberof TopNOfferWall + */ + availabilityCount: any; + + /** + * @type {any} + * @memberof TopNOfferWall + */ + buckets?: any; + + /** + * The format describing the str representation of a payout. Typically, this would be displayed to a user. The payout_format is similar to python format string with a subset of functionality supported. Only float with a precision are supported along with an optional comma for a thousands separator. In addition, a mathematical operator can be applied, such as dividing by 100. Examples are shown assuming payout = 100 (one dollar). - \"{payout*10:,.0f} Points\" -> \"1,000 Points\" - \"${payout/100:.2f}\" -> \"$1.00\" + * + * @type {any} + * @memberof TopNOfferWall + */ + payoutFormat: any; +} diff --git a/src/api/models/top-nplus-block-offer-wall-response.ts b/src/api/models/top-nplus-block-offer-wall-response.ts new file mode 100644 index 0000000..9dc64b9 --- /dev/null +++ b/src/api/models/top-nplus-block-offer-wall-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { OfferWallInfo } from './offer-wall-info'; +import { TopNPlusBlockOfferWall } from './top-nplus-block-offer-wall'; + /** + * + * + * @export + * @interface TopNPlusBlockOfferWallResponse + */ +export interface TopNPlusBlockOfferWallResponse { + + /** + * @type {OfferWallInfo} + * @memberof TopNPlusBlockOfferWallResponse + */ + info: OfferWallInfo; + + /** + * @type {TopNPlusBlockOfferWall} + * @memberof TopNPlusBlockOfferWallResponse + */ + offerwall: TopNPlusBlockOfferWall; +} diff --git a/src/api/models/top-nplus-block-offer-wall.ts b/src/api/models/top-nplus-block-offer-wall.ts new file mode 100644 index 0000000..c6d2103 --- /dev/null +++ b/src/api/models/top-nplus-block-offer-wall.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Same as the TopNOfferWall, but the buckets include contents and no buckets are returned if the user is blocked. Offerwall code: `d48cce47` + * + * @export + * @interface TopNPlusBlockOfferWall + */ +export interface TopNPlusBlockOfferWall { + + /** + * Unique identifier to reference a generated offerwall + * + * @type {any} + * @memberof TopNPlusBlockOfferWall + */ + id: any; + + /** + * Total opportunities available for specific bpuid respondent and parameters. This value changes frequently and can be used to determine if a respondent has potential tasks available, regardless of the offerwall type being requested. If the value is 0, no buckets will be generated. + * + * @type {any} + * @memberof TopNPlusBlockOfferWall + */ + availabilityCount: any; + + /** + * @type {any} + * @memberof TopNPlusBlockOfferWall + */ + buckets?: any; +} diff --git a/src/api/models/top-nplus-block-recontact-offer-wall-response.ts b/src/api/models/top-nplus-block-recontact-offer-wall-response.ts new file mode 100644 index 0000000..7ffb5ac --- /dev/null +++ b/src/api/models/top-nplus-block-recontact-offer-wall-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { OfferWallInfo } from './offer-wall-info'; +import { TopNPlusBlockRecontactOfferWall } from './top-nplus-block-recontact-offer-wall'; + /** + * + * + * @export + * @interface TopNPlusBlockRecontactOfferWallResponse + */ +export interface TopNPlusBlockRecontactOfferWallResponse { + + /** + * @type {OfferWallInfo} + * @memberof TopNPlusBlockRecontactOfferWallResponse + */ + info: OfferWallInfo; + + /** + * @type {TopNPlusBlockRecontactOfferWall} + * @memberof TopNPlusBlockRecontactOfferWallResponse + */ + offerwall: TopNPlusBlockRecontactOfferWall; +} diff --git a/src/api/models/top-nplus-block-recontact-offer-wall.ts b/src/api/models/top-nplus-block-recontact-offer-wall.ts new file mode 100644 index 0000000..5ff2743 --- /dev/null +++ b/src/api/models/top-nplus-block-recontact-offer-wall.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Same as the TopNOfferWall, but the buckets include contents, no buckets are returned if the user is blocked, and each bucket includes a `is_recontact` key. Offerwall code: `1e5f0af8` + * + * @export + * @interface TopNPlusBlockRecontactOfferWall + */ +export interface TopNPlusBlockRecontactOfferWall { + + /** + * Unique identifier to reference a generated offerwall + * + * @type {any} + * @memberof TopNPlusBlockRecontactOfferWall + */ + id: any; + + /** + * Total opportunities available for specific bpuid respondent and parameters. This value changes frequently and can be used to determine if a respondent has potential tasks available, regardless of the offerwall type being requested. If the value is 0, no buckets will be generated. + * + * @type {any} + * @memberof TopNPlusBlockRecontactOfferWall + */ + availabilityCount: any; + + /** + * @type {any} + * @memberof TopNPlusBlockRecontactOfferWall + */ + buckets?: any; +} diff --git a/src/api/models/top-nplus-bucket.ts b/src/api/models/top-nplus-bucket.ts new file mode 100644 index 0000000..2bfdb9e --- /dev/null +++ b/src/api/models/top-nplus-bucket.ts @@ -0,0 +1,110 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { DurationSummary } from './duration-summary'; +import { PayoutSummary } from './payout-summary'; + /** + * + * + * @export + * @interface TopNPlusBucket + */ +export interface TopNPlusBucket { + + /** + * Unique identifier this particular bucket + * + * @type {any} + * @memberof TopNPlusBucket + */ + id: any; + + /** + * The URL to send a respondent into. Must not edit this URL in any way + * + * @type {any} + * @memberof TopNPlusBucket + */ + uri: any; + + /** + * For UI. Provides a dimensionality position for the bucket on the x-axis. + * + * @type {any} + * @memberof TopNPlusBucket + */ + x?: any; + + /** + * For UI. Provides a dimensionality position for the bucket on the y-axis. + * + * @type {any} + * @memberof TopNPlusBucket + */ + y?: any; + + /** + * Currently unused. Will always return empty string + * + * @type {any} + * @memberof TopNPlusBucket + */ + name?: any; + + /** + * Currently unused. Will always return empty string + * + * @type {any} + * @memberof TopNPlusBucket + */ + description?: any; + + /** + * @type {any} + * @memberof TopNPlusBucket + */ + category?: any; + + /** + * @type {any} + * @memberof TopNPlusBucket + */ + contents: any; + + /** + * @type {DurationSummary} + * @memberof TopNPlusBucket + */ + duration: DurationSummary; + + /** + * @type {PayoutSummary} + * @memberof TopNPlusBucket + */ + payout: PayoutSummary; + + /** + * @type {any} + * @memberof TopNPlusBucket + */ + qualityScore: any; + + /** + * This will always be 'USD' + * + * @type {any} + * @memberof TopNPlusBucket + */ + currency?: any; +} diff --git a/src/api/models/top-nplus-offer-wall-response.ts b/src/api/models/top-nplus-offer-wall-response.ts new file mode 100644 index 0000000..6fba32b --- /dev/null +++ b/src/api/models/top-nplus-offer-wall-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { OfferWallInfo } from './offer-wall-info'; +import { TopNPlusOfferWall } from './top-nplus-offer-wall'; + /** + * + * + * @export + * @interface TopNPlusOfferWallResponse + */ +export interface TopNPlusOfferWallResponse { + + /** + * @type {OfferWallInfo} + * @memberof TopNPlusOfferWallResponse + */ + info: OfferWallInfo; + + /** + * @type {TopNPlusOfferWall} + * @memberof TopNPlusOfferWallResponse + */ + offerwall: TopNPlusOfferWall; +} diff --git a/src/api/models/top-nplus-offer-wall.ts b/src/api/models/top-nplus-offer-wall.ts new file mode 100644 index 0000000..f718dee --- /dev/null +++ b/src/api/models/top-nplus-offer-wall.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Same as the TopNOfferWall, but the buckets include contents. Offerwall code: `b145b803` + * + * @export + * @interface TopNPlusOfferWall + */ +export interface TopNPlusOfferWall { + + /** + * Unique identifier to reference a generated offerwall + * + * @type {any} + * @memberof TopNPlusOfferWall + */ + id: any; + + /** + * Total opportunities available for specific bpuid respondent and parameters. This value changes frequently and can be used to determine if a respondent has potential tasks available, regardless of the offerwall type being requested. If the value is 0, no buckets will be generated. + * + * @type {any} + * @memberof TopNPlusOfferWall + */ + availabilityCount: any; + + /** + * @type {any} + * @memberof TopNPlusOfferWall + */ + buckets?: any; +} diff --git a/src/api/models/top-nplus-recontact-bucket.ts b/src/api/models/top-nplus-recontact-bucket.ts new file mode 100644 index 0000000..9fcbab2 --- /dev/null +++ b/src/api/models/top-nplus-recontact-bucket.ts @@ -0,0 +1,116 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { DurationSummary } from './duration-summary'; +import { PayoutSummary } from './payout-summary'; + /** + * + * + * @export + * @interface TopNPlusRecontactBucket + */ +export interface TopNPlusRecontactBucket { + + /** + * Unique identifier this particular bucket + * + * @type {any} + * @memberof TopNPlusRecontactBucket + */ + id: any; + + /** + * The URL to send a respondent into. Must not edit this URL in any way + * + * @type {any} + * @memberof TopNPlusRecontactBucket + */ + uri: any; + + /** + * For UI. Provides a dimensionality position for the bucket on the x-axis. + * + * @type {any} + * @memberof TopNPlusRecontactBucket + */ + x?: any; + + /** + * For UI. Provides a dimensionality position for the bucket on the y-axis. + * + * @type {any} + * @memberof TopNPlusRecontactBucket + */ + y?: any; + + /** + * Currently unused. Will always return empty string + * + * @type {any} + * @memberof TopNPlusRecontactBucket + */ + name?: any; + + /** + * Currently unused. Will always return empty string + * + * @type {any} + * @memberof TopNPlusRecontactBucket + */ + description?: any; + + /** + * @type {any} + * @memberof TopNPlusRecontactBucket + */ + category?: any; + + /** + * @type {any} + * @memberof TopNPlusRecontactBucket + */ + contents: any; + + /** + * @type {DurationSummary} + * @memberof TopNPlusRecontactBucket + */ + duration: DurationSummary; + + /** + * @type {PayoutSummary} + * @memberof TopNPlusRecontactBucket + */ + payout: PayoutSummary; + + /** + * @type {any} + * @memberof TopNPlusRecontactBucket + */ + qualityScore: any; + + /** + * @type {any} + * @memberof TopNPlusRecontactBucket + */ + isRecontact: any; + + /** + * This will always be 'USD' + * + * @type {any} + * @memberof TopNPlusRecontactBucket + */ + currency?: any; +} diff --git a/src/api/models/upk-question-choice-out.ts b/src/api/models/upk-question-choice-out.ts new file mode 100644 index 0000000..916ee38 --- /dev/null +++ b/src/api/models/upk-question-choice-out.ts @@ -0,0 +1,58 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface UpkQuestionChoiceOut + */ +export interface UpkQuestionChoiceOut { + + /** + * The unique identifier for a response to a qualification + * + * @type {any} + * @memberof UpkQuestionChoiceOut + */ + choiceId: any; + + /** + * The response text shown to respondents + * + * @type {any} + * @memberof UpkQuestionChoiceOut + */ + choiceText: any; + + /** + * @type {any} + * @memberof UpkQuestionChoiceOut + */ + order: any; + + /** + * @type {any} + * @memberof UpkQuestionChoiceOut + */ + group?: any; + + /** + * If answer is exclusive, it can be the only option selected + * + * @type {any} + * @memberof UpkQuestionChoiceOut + */ + exclusive?: any; +} diff --git a/src/api/models/upk-question-choice.ts b/src/api/models/upk-question-choice.ts new file mode 100644 index 0000000..2c81e74 --- /dev/null +++ b/src/api/models/upk-question-choice.ts @@ -0,0 +1,64 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface UpkQuestionChoice + */ +export interface UpkQuestionChoice { + + /** + * The unique identifier for a response to a qualification + * + * @type {any} + * @memberof UpkQuestionChoice + */ + choiceId: any; + + /** + * The response text shown to respondents + * + * @type {any} + * @memberof UpkQuestionChoice + */ + choiceText: any; + + /** + * @type {any} + * @memberof UpkQuestionChoice + */ + order: any; + + /** + * @type {any} + * @memberof UpkQuestionChoice + */ + group?: any; + + /** + * If answer is exclusive, it can be the only option selected + * + * @type {any} + * @memberof UpkQuestionChoice + */ + exclusive?: any; + + /** + * @type {any} + * @memberof UpkQuestionChoice + */ + importance?: any; +} diff --git a/src/api/models/upk-question-configuration-mc.ts b/src/api/models/upk-question-configuration-mc.ts new file mode 100644 index 0000000..a94ef25 --- /dev/null +++ b/src/api/models/upk-question-configuration-mc.ts @@ -0,0 +1,28 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface UpkQuestionConfigurationMC + */ +export interface UpkQuestionConfigurationMC { + + /** + * @type {any} + * @memberof UpkQuestionConfigurationMC + */ + maxSelect?: any; +} diff --git a/src/api/models/upk-question-configuration-slider.ts b/src/api/models/upk-question-configuration-slider.ts new file mode 100644 index 0000000..e295217 --- /dev/null +++ b/src/api/models/upk-question-configuration-slider.ts @@ -0,0 +1,46 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface UpkQuestionConfigurationSLIDER + */ +export interface UpkQuestionConfigurationSLIDER { + + /** + * @type {any} + * @memberof UpkQuestionConfigurationSLIDER + */ + sliderMin?: any; + + /** + * @type {any} + * @memberof UpkQuestionConfigurationSLIDER + */ + sliderMax?: any; + + /** + * @type {any} + * @memberof UpkQuestionConfigurationSLIDER + */ + sliderStart?: any; + + /** + * @type {any} + * @memberof UpkQuestionConfigurationSLIDER + */ + sliderStep?: any; +} diff --git a/src/api/models/upk-question-configuration-te.ts b/src/api/models/upk-question-configuration-te.ts new file mode 100644 index 0000000..b66658e --- /dev/null +++ b/src/api/models/upk-question-configuration-te.ts @@ -0,0 +1,38 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface UpkQuestionConfigurationTE + */ +export interface UpkQuestionConfigurationTE { + + /** + * Maximum str length of any input. Meant as an easy, nonregex based check. + * + * @type {any} + * @memberof UpkQuestionConfigurationTE + */ + maxLength?: any; + + /** + * Minimum str length of any input. Meant as an easy, nonregex based check. + * + * @type {any} + * @memberof UpkQuestionConfigurationTE + */ + minLength?: any; +} diff --git a/src/api/models/upk-question-out.ts b/src/api/models/upk-question-out.ts new file mode 100644 index 0000000..cb73ea2 --- /dev/null +++ b/src/api/models/upk-question-out.ts @@ -0,0 +1,109 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { UpkQuestionType } from './upk-question-type'; + /** + * + * + * @export + * @interface UpkQuestionOut + */ +export interface UpkQuestionOut { + + /** + * @type {any} + * @memberof UpkQuestionOut + */ + questionId?: any; + + /** + * what marketplace question this question links to + * + * @type {any} + * @memberof UpkQuestionOut + */ + extQuestionId?: any; + + /** + * @type {UpkQuestionType} + * @memberof UpkQuestionOut + */ + questionType: UpkQuestionType; + + /** + * @type {any} + * @memberof UpkQuestionOut + */ + countryIso: any; + + /** + * @type {any} + * @memberof UpkQuestionOut + */ + languageIso: any; + + /** + * The text shown to respondents + * + * @type {any} + * @memberof UpkQuestionOut + */ + questionText: any; + + /** + * @type {any} + * @memberof UpkQuestionOut + */ + choices?: any; + + /** + * @type {any} + * @memberof UpkQuestionOut + */ + selector?: any; + + /** + * @type {any} + * @memberof UpkQuestionOut + */ + configuration?: any; + + /** + * @type {any} + * @memberof UpkQuestionOut + */ + validation?: any; + + /** + * The number of live Tasks that use this UPK Question + * + * @type {any} + * @memberof UpkQuestionOut + */ + taskCount?: any; + + /** + * GRL's internal ranked score for the UPK Question + * + * @type {any} + * @memberof UpkQuestionOut + */ + taskScore?: any; + + /** + * @type {any} + * @memberof UpkQuestionOut + */ + p?: any; +} diff --git a/src/api/models/upk-question-response.ts b/src/api/models/upk-question-response.ts new file mode 100644 index 0000000..03323ff --- /dev/null +++ b/src/api/models/upk-question-response.ts @@ -0,0 +1,68 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface UpkQuestionResponse + */ +export interface UpkQuestionResponse { + + /** + * The status of the API response. + * + * @type {any} + * @memberof UpkQuestionResponse + */ + status: any; + + /** + * An optional message, if the status is error. + * + * @type {any} + * @memberof UpkQuestionResponse + */ + msg?: any; + + /** + * @type {any} + * @memberof UpkQuestionResponse + */ + questions: any; + + /** + * For internal use + * + * @type {any} + * @memberof UpkQuestionResponse + */ + consentQuestions?: any; + + /** + * For internal use + * + * @type {any} + * @memberof UpkQuestionResponse + */ + specialQuestions?: any; + + /** + * The number of questions returned + * + * @type {any} + * @memberof UpkQuestionResponse + */ + count: any; +} diff --git a/src/api/models/upk-question-selector-hidden.ts b/src/api/models/upk-question-selector-hidden.ts new file mode 100644 index 0000000..1da912a --- /dev/null +++ b/src/api/models/upk-question-selector-hidden.ts @@ -0,0 +1,23 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * + * @export + * @enum {string} + */ +export enum UpkQuestionSelectorHIDDEN { + HIDDEN = 'HIDDEN' +} + diff --git a/src/api/models/upk-question-selector-mc.ts b/src/api/models/upk-question-selector-mc.ts new file mode 100644 index 0000000..550388f --- /dev/null +++ b/src/api/models/upk-question-selector-mc.ts @@ -0,0 +1,27 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * + * @export + * @enum {string} + */ +export enum UpkQuestionSelectorMC { + SA = 'SA', + MA = 'MA', + DL = 'DL', + SB = 'SB', + MSB = 'MSB' +} + diff --git a/src/api/models/upk-question-selector-slider.ts b/src/api/models/upk-question-selector-slider.ts new file mode 100644 index 0000000..f16dd7f --- /dev/null +++ b/src/api/models/upk-question-selector-slider.ts @@ -0,0 +1,24 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * + * @export + * @enum {string} + */ +export enum UpkQuestionSelectorSLIDER { + HSLIDER = 'HSLIDER', + VSLIDER = 'VSLIDER' +} + diff --git a/src/api/models/upk-question-selector-te.ts b/src/api/models/upk-question-selector-te.ts new file mode 100644 index 0000000..b986845 --- /dev/null +++ b/src/api/models/upk-question-selector-te.ts @@ -0,0 +1,25 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * + * @export + * @enum {string} + */ +export enum UpkQuestionSelectorTE { + SL = 'SL', + ML = 'ML', + ETB = 'ETB' +} + diff --git a/src/api/models/upk-question-type.ts b/src/api/models/upk-question-type.ts new file mode 100644 index 0000000..7072355 --- /dev/null +++ b/src/api/models/upk-question-type.ts @@ -0,0 +1,26 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * + * @export + * @enum {string} + */ +export enum UpkQuestionType { + MC = 'MC', + TE = 'TE', + SLIDER = 'SLIDER', + HIDDEN = 'HIDDEN' +} + diff --git a/src/api/models/upk-question-validation.ts b/src/api/models/upk-question-validation.ts new file mode 100644 index 0000000..d8470fe --- /dev/null +++ b/src/api/models/upk-question-validation.ts @@ -0,0 +1,28 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface UpkQuestionValidation + */ +export interface UpkQuestionValidation { + + /** + * @type {any} + * @memberof UpkQuestionValidation + */ + patterns: any; +} diff --git a/src/api/models/upk-question.ts b/src/api/models/upk-question.ts new file mode 100644 index 0000000..045457e --- /dev/null +++ b/src/api/models/upk-question.ts @@ -0,0 +1,93 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { UpkQuestionType } from './upk-question-type'; + /** + * + * + * @export + * @interface UpkQuestion + */ +export interface UpkQuestion { + + /** + * @type {any} + * @memberof UpkQuestion + */ + questionId?: any; + + /** + * what marketplace question this question links to + * + * @type {any} + * @memberof UpkQuestion + */ + extQuestionId?: any; + + /** + * @type {UpkQuestionType} + * @memberof UpkQuestion + */ + questionType: UpkQuestionType; + + /** + * @type {any} + * @memberof UpkQuestion + */ + countryIso: any; + + /** + * @type {any} + * @memberof UpkQuestion + */ + languageIso: any; + + /** + * The text shown to respondents + * + * @type {any} + * @memberof UpkQuestion + */ + questionText: any; + + /** + * @type {any} + * @memberof UpkQuestion + */ + choices?: any; + + /** + * @type {any} + * @memberof UpkQuestion + */ + selector?: any; + + /** + * @type {any} + * @memberof UpkQuestion + */ + configuration?: any; + + /** + * @type {any} + * @memberof UpkQuestion + */ + validation?: any; + + /** + * @type {any} + * @memberof UpkQuestion + */ + importance?: any; +} diff --git a/src/api/models/upkimportance.ts b/src/api/models/upkimportance.ts new file mode 100644 index 0000000..a6b3c15 --- /dev/null +++ b/src/api/models/upkimportance.ts @@ -0,0 +1,38 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface UPKImportance + */ +export interface UPKImportance { + + /** + * The number of live Tasks that use this UPK Question + * + * @type {any} + * @memberof UPKImportance + */ + taskCount?: any; + + /** + * GRL's internal ranked score for the UPK Question + * + * @type {any} + * @memberof UPKImportance + */ + taskScore?: any; +} diff --git a/src/api/models/usdelivery-address.ts b/src/api/models/usdelivery-address.ts new file mode 100644 index 0000000..2a3f557 --- /dev/null +++ b/src/api/models/usdelivery-address.ts @@ -0,0 +1,70 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface USDeliveryAddress + */ +export interface USDeliveryAddress { + + /** + * @type {any} + * @memberof USDeliveryAddress + */ + nameOrAttn: any; + + /** + * @type {any} + * @memberof USDeliveryAddress + */ + company?: any; + + /** + * @type {any} + * @memberof USDeliveryAddress + */ + phoneNumber?: any; + + /** + * @type {any} + * @memberof USDeliveryAddress + */ + address: any; + + /** + * @type {any} + * @memberof USDeliveryAddress + */ + city: any; + + /** + * @type {any} + * @memberof USDeliveryAddress + */ + state: any; + + /** + * @type {any} + * @memberof USDeliveryAddress + */ + postalCode: any; + + /** + * @type {any} + * @memberof USDeliveryAddress + */ + country?: any; +} diff --git a/src/api/models/user-info-response.ts b/src/api/models/user-info-response.ts new file mode 100644 index 0000000..4b2af90 --- /dev/null +++ b/src/api/models/user-info-response.ts @@ -0,0 +1,45 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { UserInfo } from './user-info'; + /** + * + * + * @export + * @interface UserInfoResponse + */ +export interface UserInfoResponse { + + /** + * The status of the API response. + * + * @type {any} + * @memberof UserInfoResponse + */ + status: any; + + /** + * An optional message, if the status is error. + * + * @type {any} + * @memberof UserInfoResponse + */ + msg?: any; + + /** + * @type {UserInfo} + * @memberof UserInfoResponse + */ + userProfile: UserInfo; +} diff --git a/src/api/models/user-info.ts b/src/api/models/user-info.ts new file mode 100644 index 0000000..0e1c641 --- /dev/null +++ b/src/api/models/user-info.ts @@ -0,0 +1,34 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface UserInfo + */ +export interface UserInfo { + + /** + * @type {any} + * @memberof UserInfo + */ + userProfileKnowledge?: any; + + /** + * @type {any} + * @memberof UserInfo + */ + marketplaceProfileKnowledge?: any; +} diff --git a/src/api/models/user-profile-knowledge-answer.ts b/src/api/models/user-profile-knowledge-answer.ts new file mode 100644 index 0000000..06787f9 --- /dev/null +++ b/src/api/models/user-profile-knowledge-answer.ts @@ -0,0 +1,46 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface UserProfileKnowledgeAnswer + */ +export interface UserProfileKnowledgeAnswer { + + /** + * @type {any} + * @memberof UserProfileKnowledgeAnswer + */ + id?: any; + + /** + * @type {any} + * @memberof UserProfileKnowledgeAnswer + */ + label?: any; + + /** + * @type {any} + * @memberof UserProfileKnowledgeAnswer + */ + translation?: any; + + /** + * @type {any} + * @memberof UserProfileKnowledgeAnswer + */ + value?: any; +} diff --git a/src/api/models/user-profile-knowledge.ts b/src/api/models/user-profile-knowledge.ts new file mode 100644 index 0000000..30a182a --- /dev/null +++ b/src/api/models/user-profile-knowledge.ts @@ -0,0 +1,54 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface UserProfileKnowledge + */ +export interface UserProfileKnowledge { + + /** + * @type {any} + * @memberof UserProfileKnowledge + */ + propertyId: any; + + /** + * @type {any} + * @memberof UserProfileKnowledge + */ + propertyLabel: any; + + /** + * @type {any} + * @memberof UserProfileKnowledge + */ + translation: any; + + /** + * @type {any} + * @memberof UserProfileKnowledge + */ + answer?: any; + + /** + * When the User submitted this Profiling data + * + * @type {any} + * @memberof UserProfileKnowledge + */ + created: any; +} diff --git a/src/api/models/user-question-answer-in.ts b/src/api/models/user-question-answer-in.ts new file mode 100644 index 0000000..74b75ef --- /dev/null +++ b/src/api/models/user-question-answer-in.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Send the answers to one or more questions for a user. A question is uniquely specified by the question_id key. The answer is: the choice_id if the question_type is \"MC\" the actual entered text if the question_type is \"TE\" TODO: look up the question_type from the question_id to apply MC or TE specific validation on the answer(s) + * + * @export + * @interface UserQuestionAnswerIn + */ +export interface UserQuestionAnswerIn { + + /** + * @type {any} + * @memberof UserQuestionAnswerIn + */ + questionId: any; + + /** + * The user's answers to this question. Must pass the choice_id if the question is a Multiple Choice, or the actual text if the question is Text Entry + * + * @type {any} + * @memberof UserQuestionAnswerIn + */ + answer: any; +} diff --git a/src/api/models/user-transaction-history-response.ts b/src/api/models/user-transaction-history-response.ts new file mode 100644 index 0000000..7664a71 --- /dev/null +++ b/src/api/models/user-transaction-history-response.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface UserTransactionHistoryResponse + */ +export interface UserTransactionHistoryResponse { + + /** + * The status of the API response. + * + * @type {any} + * @memberof UserTransactionHistoryResponse + */ + status: any; + + /** + * An optional message, if the status is error. + * + * @type {any} + * @memberof UserTransactionHistoryResponse + */ + msg?: any; + + /** + * @type {any} + * @memberof UserTransactionHistoryResponse + */ + transactionHistory?: any; +} diff --git a/src/api/models/user-transaction-row.ts b/src/api/models/user-transaction-row.ts new file mode 100644 index 0000000..abfe579 --- /dev/null +++ b/src/api/models/user-transaction-row.ts @@ -0,0 +1,90 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface UserTransactionRow + */ +export interface UserTransactionRow { + + /** + * (USD cents) Positive is an increase in the user's wallet balance. For e.g.requesting a gift card would show as a negative amount. + * + * @type {any} + * @memberof UserTransactionRow + */ + amount: any; + + /** + * The 'amount' with the payout_format applied. Can be displayed to the user. + * + * @type {any} + * @memberof UserTransactionRow + */ + amountString: any; + + /** + * The product_user_id + * + * @type {any} + * @memberof UserTransactionRow + */ + bpuid: any; + + /** + * This is the name of the cashout method. + * + * @type {any} + * @memberof UserTransactionRow + */ + description: any; + + /** + * @type {any} + * @memberof UserTransactionRow + */ + id: any; + + /** + * The format describing the str representation of a payout. Typically, this would be displayed to a user. The payout_format is similar to python format string with a subset of functionality supported. Only float with a precision are supported along with an optional comma for a thousands separator. In addition, a mathematical operator can be applied, such as dividing by 100. Examples are shown assuming payout = 100 (one dollar). - \"{payout*10:,.0f} Points\" -> \"1,000 Points\" - \"${payout/100:.2f}\" -> \"$1.00\" + * + * @type {any} + * @memberof UserTransactionRow + */ + payoutFormat: any; + + /** + * - `PENDING` = PENDING - `APPROVED` = APPROVED - `REJECTED` = REJECTED - `CANCELLED` = CANCELLED - `FAILED` = FAILED - `COMPLETE` = COMPLETE + * + * @type {any} + * @memberof UserTransactionRow + */ + status?: any; + + /** + * @type {any} + * @memberof UserTransactionRow + */ + timestamp: any; + + /** + * - `TASK_COMPLETE` = TASK_COMPLETE - `RECONCILE` = RECONCILE - `CASHOUT` = CASHOUT - `BONUS` = BONUS + * + * @type {any} + * @memberof UserTransactionRow + */ + type: any; +} diff --git a/src/api/models/user-wallet-balance-response.ts b/src/api/models/user-wallet-balance-response.ts new file mode 100644 index 0000000..f168bcd --- /dev/null +++ b/src/api/models/user-wallet-balance-response.ts @@ -0,0 +1,45 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { UserWalletBalance } from './user-wallet-balance'; + /** + * + * + * @export + * @interface UserWalletBalanceResponse + */ +export interface UserWalletBalanceResponse { + + /** + * The status of the API response. + * + * @type {any} + * @memberof UserWalletBalanceResponse + */ + status: any; + + /** + * An optional message, if the status is error. + * + * @type {any} + * @memberof UserWalletBalanceResponse + */ + msg?: any; + + /** + * @type {UserWalletBalance} + * @memberof UserWalletBalanceResponse + */ + wallet: UserWalletBalance; +} diff --git a/src/api/models/user-wallet-balance.ts b/src/api/models/user-wallet-balance.ts new file mode 100644 index 0000000..92f55ff --- /dev/null +++ b/src/api/models/user-wallet-balance.ts @@ -0,0 +1,62 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface UserWalletBalance + */ +export interface UserWalletBalance { + + /** + * (USD cents) The amount in the user's wallet. + * + * @type {any} + * @memberof UserWalletBalance + */ + amount: any; + + /** + * (USD cents) The amount in the user's wallet this is currently redeemable. + * + * @type {any} + * @memberof UserWalletBalance + */ + redeemableAmount: any; + + /** + * The format describing the str representation of a payout. Typically, this would be displayed to a user. The payout_format is similar to python format string with a subset of functionality supported. Only float with a precision are supported along with an optional comma for a thousands separator. In addition, a mathematical operator can be applied, such as dividing by 100. Examples are shown assuming payout = 100 (one dollar). - \"{payout*10:,.0f} Points\" -> \"1,000 Points\" - \"${payout/100:.2f}\" -> \"$1.00\" + * + * @type {any} + * @memberof UserWalletBalance + */ + payoutFormat: any; + + /** + * The 'amount' with the payout_format applied. Can be displayed to the user. + * + * @type {any} + * @memberof UserWalletBalance + */ + amountString: any; + + /** + * The 'redeemable_amount' with the payout_format applied. Can be displayed to the user. + * + * @type {any} + * @memberof UserWalletBalance + */ + redeemableAmountString: any; +} diff --git a/src/api/models/user-wallet-config.ts b/src/api/models/user-wallet-config.ts new file mode 100644 index 0000000..8e26ac6 --- /dev/null +++ b/src/api/models/user-wallet-config.ts @@ -0,0 +1,52 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Stores configuration for the user wallet handling + * + * @export + * @interface UserWalletConfig + */ +export interface UserWalletConfig { + + /** + * If enabled, the users' wallets are managed. + * + * @type {any} + * @memberof UserWalletConfig + */ + enabled?: any; + + /** + * Uses Amazon Mechanical Turk + * + * @type {any} + * @memberof UserWalletConfig + */ + amt?: any; + + /** + * @type {any} + * @memberof UserWalletConfig + */ + supportedPayoutTypes?: any; + + /** + * Minimum cashout amount. If enabled is True and no min_cashout is set, will default to $0.01. + * + * @type {any} + * @memberof UserWalletConfig + */ + minCashout?: any; +} diff --git a/src/api/models/user-wallet-transaction-type.ts b/src/api/models/user-wallet-transaction-type.ts new file mode 100644 index 0000000..256b328 --- /dev/null +++ b/src/api/models/user-wallet-transaction-type.ts @@ -0,0 +1,26 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/** + * The type of transaction + * @export + * @enum {string} + */ +export enum UserWalletTransactionType { + TASKCOMPLETE = 'TASK_COMPLETE', + RECONCILE = 'RECONCILE', + CASHOUT = 'CASHOUT', + BONUS = 'BONUS' +} + diff --git a/src/api/models/validation-error.ts b/src/api/models/validation-error.ts new file mode 100644 index 0000000..156dbfd --- /dev/null +++ b/src/api/models/validation-error.ts @@ -0,0 +1,40 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface ValidationError + */ +export interface ValidationError { + + /** + * @type {any} + * @memberof ValidationError + */ + loc: any; + + /** + * @type {any} + * @memberof ValidationError + */ + msg: any; + + /** + * @type {any} + * @memberof ValidationError + */ + type: any; +} diff --git a/src/api/models/wxetofferwall-bucket.ts b/src/api/models/wxetofferwall-bucket.ts new file mode 100644 index 0000000..0358753 --- /dev/null +++ b/src/api/models/wxetofferwall-bucket.ts @@ -0,0 +1,54 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * + * + * @export + * @interface WXETOfferwallBucket + */ +export interface WXETOfferwallBucket { + + /** + * Unique identifier this particular bucket + * + * @type {any} + * @memberof WXETOfferwallBucket + */ + id: any; + + /** + * The URL to send a respondent into. Must not edit this URL in any way + * + * @type {any} + * @memberof WXETOfferwallBucket + */ + uri: any; + + /** + * The bucket's expected duration, in seconds + * + * @type {any} + * @memberof WXETOfferwallBucket + */ + duration: any; + + /** + * The bucket's min payout, in usd cents + * + * @type {any} + * @memberof WXETOfferwallBucket + */ + minPayout: any; +} diff --git a/src/api/models/wxetofferwall-response.ts b/src/api/models/wxetofferwall-response.ts new file mode 100644 index 0000000..e0d9bf8 --- /dev/null +++ b/src/api/models/wxetofferwall-response.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { OfferWallInfo } from './offer-wall-info'; +import { WXETOfferwall } from './wxetofferwall'; + /** + * + * + * @export + * @interface WXETOfferwallResponse + */ +export interface WXETOfferwallResponse { + + /** + * @type {OfferWallInfo} + * @memberof WXETOfferwallResponse + */ + info: OfferWallInfo; + + /** + * @type {WXETOfferwall} + * @memberof WXETOfferwallResponse + */ + offerwall: WXETOfferwall; +} diff --git a/src/api/models/wxetofferwall.ts b/src/api/models/wxetofferwall.ts new file mode 100644 index 0000000..086e1ab --- /dev/null +++ b/src/api/models/wxetofferwall.ts @@ -0,0 +1,44 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * General Research Full Service Brokerage API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * Returns buckets from WXET as single tasks Offerwall code: `55a4e1a9` + * + * @export + * @interface WXETOfferwall + */ +export interface WXETOfferwall { + + /** + * Unique identifier to reference a generated offerwall + * + * @type {any} + * @memberof WXETOfferwall + */ + id: any; + + /** + * Total opportunities available for specific bpuid respondent and parameters. This value changes frequently and can be used to determine if a respondent has potential tasks available, regardless of the offerwall type being requested. If the value is 0, no buckets will be generated. + * + * @type {any} + * @memberof WXETOfferwall + */ + availabilityCount: any; + + /** + * @type {any} + * @memberof WXETOfferwall + */ + buckets?: any; +} diff --git a/src/api/package.json b/src/api/package.json new file mode 100644 index 0000000..fc2b59d --- /dev/null +++ b/src/api/package.json @@ -0,0 +1,27 @@ +{ + "name": "", + "version": "1.0.0", + "description": "OpenAPI client for ", + "author": "OpenAPI-Generator Contributors", + "keywords": [ + "axios", + "typescript", + "openapi-client", + "openapi-generator", + "" + ], + "license": "Unlicense", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "scripts": { + "build": "tsc --outDir dist/", + "prepublishOnly": "npm run build" + }, + "dependencies": { + "axios": "^0.21.1" + }, + "devDependencies": { + "@types/node": "^12.11.5", + "typescript": "^3.6.4" + } +} diff --git a/src/api/tsconfig.json b/src/api/tsconfig.json new file mode 100644 index 0000000..2f27acb --- /dev/null +++ b/src/api/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "declaration": true, + "target": "es5", + "module": "commonjs", + "noImplicitAny": true, + "outDir": "dist", + "rootDir": ".", + "lib": [ + "es6", + "dom" + ], + "typeRoots": [ + "node_modules/@types" + ] + }, + "exclude": [ + "dist", + "node_modules" + ] +} diff --git a/src/components/app-sidebar.tsx b/src/components/app-sidebar.tsx new file mode 100644 index 0000000..d2bc03e --- /dev/null +++ b/src/components/app-sidebar.tsx @@ -0,0 +1,158 @@ +"use client" + +import * as React from "react" +import {CircleDollarSign, MessageCircle, MoreVerticalIcon, SquareStack, UserCircleIcon} from "lucide-react" + +import {NavMain} from "@/components/nav-main" +import {Avatar, AvatarFallback, AvatarImage,} from "@/components/ui/avatar" +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuGroup, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu" +import { + Sidebar, + SidebarContent, + SidebarFooter, + SidebarGroup, + SidebarGroupContent, + SidebarGroupLabel, + SidebarHeader, + SidebarMenu, + SidebarMenuButton, + SidebarMenuItem, + useSidebar, +} from "@/components/ui/sidebar" +import {useAppSelector} from "@/hooks.ts"; + +export function AppSidebar({...props}: React.ComponentProps<typeof Sidebar>) { + const app = useAppSelector(state => state.app) + + const {isMobile} = useSidebar() + + // <button onClick={() => setActiveView('offerwall')}>Offerwall</button> + // <button onClick={() => setActiveView('questions')}>Questions</button> + // <button onClick={() => setActiveView('cashout')}>Cashout Methods</button> + + return ( + <Sidebar collapsible="offcanvas" {...props}> + <SidebarHeader> + <SidebarMenu> + <SidebarMenuItem> + <SidebarMenuButton + asChild + className="data-[slot=sidebar-menu-button]:!p-1.5" + > + <span className="text-base font-semibold">{app.panelName}</span> + + </SidebarMenuButton> + </SidebarMenuItem> + </SidebarMenu> + </SidebarHeader> + + <SidebarContent> + <NavMain></NavMain> + </SidebarContent> + + <SidebarContent> + <SidebarGroup> + <SidebarGroupLabel>Redemption</SidebarGroupLabel> + <SidebarGroupContent> + <SidebarMenu> + + <SidebarMenuItem key="cashout_methods"> + <SidebarMenuButton asChild> + <a href="#"> + <CircleDollarSign/> + <span>Methods</span> + </a> + </SidebarMenuButton> + </SidebarMenuItem> + + <SidebarMenuItem key="cashout_history"> + <SidebarMenuButton asChild> + <a href="#"> + <SquareStack/> + <span>History</span> + </a> + </SidebarMenuButton> + </SidebarMenuItem> + + </SidebarMenu> + </SidebarGroupContent> + </SidebarGroup> + </SidebarContent> + + <SidebarGroupContent> + <SidebarMenu> + <SidebarMenuItem key="support"> + <SidebarMenuButton asChild> + <a href="#"> + <MessageCircle/> + <span>Support</span> + </a> + </SidebarMenuButton> + </SidebarMenuItem> + </SidebarMenu> + </SidebarGroupContent> + + + <SidebarFooter> + <DropdownMenu> + <DropdownMenuTrigger> + <SidebarMenuButton + size="lg" + className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground" + > + <Avatar className="h-8 w-8 rounded-lg grayscale"> + <AvatarImage src="#" alt="foo"/> + <AvatarFallback className="rounded-lg">IW</AvatarFallback> + </Avatar> + <div className="grid flex-1 text-left text-sm leading-tight"> + <span className="truncate font-medium">Ironwood User</span> + <span className="truncate text-xs text-muted-foreground"> + ironwood@example.com + </span> + </div> + <MoreVerticalIcon className="ml-auto size-4"/> + </SidebarMenuButton> + </DropdownMenuTrigger> + <DropdownMenuContent + className="w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-lg" + side={isMobile ? "bottom" : "right"} + align="end" + sideOffset={4} + > + <DropdownMenuLabel className="p-0 font-normal"> + <div className="flex items-center gap-2 px-1 py-1.5 text-left text-sm"> + <Avatar className="h-8 w-8 rounded-lg"> + <AvatarImage src="#" alt="Ironwood User"/> + <AvatarFallback className="rounded-lg">IW</AvatarFallback> + </Avatar> + <div className="grid flex-1 text-left text-sm leading-tight"> + <span className="truncate font-medium">Ironwood User</span> + <span className="truncate text-xs text-muted-foreground"> + ironwood@example.com + </span> + </div> + </div> + </DropdownMenuLabel> + <DropdownMenuSeparator/> + <DropdownMenuGroup> + <DropdownMenuItem> + <UserCircleIcon/> + Account + </DropdownMenuItem> + </DropdownMenuGroup> + <DropdownMenuSeparator/> + </DropdownMenuContent> + </DropdownMenu> + </SidebarFooter> + + </Sidebar> + ) +} diff --git a/src/components/nav-main.tsx b/src/components/nav-main.tsx new file mode 100644 index 0000000..873d236 --- /dev/null +++ b/src/components/nav-main.tsx @@ -0,0 +1,52 @@ +"use client" + +import {ListIcon, NotebookText, Users} from "lucide-react" +import { + SidebarGroup, + SidebarGroupContent, + SidebarMenu, + SidebarMenuButton, + SidebarMenuItem, +} from "@/components/ui/sidebar" +import {setPage} from "@/models/appSlice.ts"; +import {useAppDispatch} from "@/hooks.ts"; + +export function NavMain() { + const dispatch = useAppDispatch() + + return ( + <SidebarGroup> + <SidebarGroupContent className="flex flex-col gap-2"> + <SidebarMenu> + + <SidebarMenuItem key="Surveys" + onClick={() => dispatch(setPage("offerwall"))} + > + <SidebarMenuButton tooltip="Surveys"> + <NotebookText/> + <span>Surveys</span> + </SidebarMenuButton> + </SidebarMenuItem> + + + <SidebarMenuItem key="Questions" + onClick={() => dispatch(setPage("questions"))} + > + <SidebarMenuButton tooltip="Questions"> + <ListIcon/> + <span>Questions</span> + </SidebarMenuButton> + </SidebarMenuItem> + + <SidebarMenuItem key="Community"> + <SidebarMenuButton tooltip="Community"> + <Users/> + <span>Community</span> + </SidebarMenuButton> + </SidebarMenuItem> + + </SidebarMenu> + </SidebarGroupContent> + </SidebarGroup> + ) +} diff --git a/src/components/site-header.tsx b/src/components/site-header.tsx new file mode 100644 index 0000000..5bc5ca7 --- /dev/null +++ b/src/components/site-header.tsx @@ -0,0 +1,24 @@ +import {Separator} from "@/components/ui/separator" +import {SidebarTrigger} from "@/components/ui/sidebar" +import React from "react"; + +const SiteHeader = () => { + + return ( + <header + className="group-has-data-[collapsible=icon]/sidebar-wrapper:h-12 flex h-12 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear"> + <div className="flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6"> + <SidebarTrigger/> + + <Separator + orientation="vertical" + className="mx-2 data-[orientation=vertical]:h-4" + /> + <h1 className="text-base font-medium">"activeView"</h1> + + </div> + </header> + ) +} + +export {SiteHeader}
\ No newline at end of file diff --git a/src/components/ui/accordion.tsx b/src/components/ui/accordion.tsx new file mode 100644 index 0000000..d21b65f --- /dev/null +++ b/src/components/ui/accordion.tsx @@ -0,0 +1,64 @@ +import * as React from "react" +import * as AccordionPrimitive from "@radix-ui/react-accordion" +import { ChevronDownIcon } from "lucide-react" + +import { cn } from "@/lib/utils" + +function Accordion({ + ...props +}: React.ComponentProps<typeof AccordionPrimitive.Root>) { + return <AccordionPrimitive.Root data-slot="accordion" {...props} /> +} + +function AccordionItem({ + className, + ...props +}: React.ComponentProps<typeof AccordionPrimitive.Item>) { + return ( + <AccordionPrimitive.Item + data-slot="accordion-item" + className={cn("border-b last:border-b-0", className)} + {...props} + /> + ) +} + +function AccordionTrigger({ + className, + children, + ...props +}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) { + return ( + <AccordionPrimitive.Header className="flex"> + <AccordionPrimitive.Trigger + data-slot="accordion-trigger" + className={cn( + "focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180", + className + )} + {...props} + > + {children} + <ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" /> + </AccordionPrimitive.Trigger> + </AccordionPrimitive.Header> + ) +} + +function AccordionContent({ + className, + children, + ...props +}: React.ComponentProps<typeof AccordionPrimitive.Content>) { + return ( + <AccordionPrimitive.Content + data-slot="accordion-content" + className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm" + {...props} + > + <div className={cn("pt-0 pb-4", className)}>{children}</div> + </AccordionPrimitive.Content> + ) +} + +export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } diff --git a/src/components/ui/alert-dialog.tsx b/src/components/ui/alert-dialog.tsx new file mode 100644 index 0000000..0863e40 --- /dev/null +++ b/src/components/ui/alert-dialog.tsx @@ -0,0 +1,157 @@ +"use client" + +import * as React from "react" +import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog" + +import { cn } from "@/lib/utils" +import { buttonVariants } from "@/components/ui/button" + +function AlertDialog({ + ...props +}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) { + return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} /> +} + +function AlertDialogTrigger({ + ...props +}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) { + return ( + <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} /> + ) +} + +function AlertDialogPortal({ + ...props +}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) { + return ( + <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} /> + ) +} + +function AlertDialogOverlay({ + className, + ...props +}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) { + return ( + <AlertDialogPrimitive.Overlay + data-slot="alert-dialog-overlay" + className={cn( + "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", + className + )} + {...props} + /> + ) +} + +function AlertDialogContent({ + className, + ...props +}: React.ComponentProps<typeof AlertDialogPrimitive.Content>) { + return ( + <AlertDialogPortal> + <AlertDialogOverlay /> + <AlertDialogPrimitive.Content + data-slot="alert-dialog-content" + className={cn( + "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg", + className + )} + {...props} + /> + </AlertDialogPortal> + ) +} + +function AlertDialogHeader({ + className, + ...props +}: React.ComponentProps<"div">) { + return ( + <div + data-slot="alert-dialog-header" + className={cn("flex flex-col gap-2 text-center sm:text-left", className)} + {...props} + /> + ) +} + +function AlertDialogFooter({ + className, + ...props +}: React.ComponentProps<"div">) { + return ( + <div + data-slot="alert-dialog-footer" + className={cn( + "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", + className + )} + {...props} + /> + ) +} + +function AlertDialogTitle({ + className, + ...props +}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) { + return ( + <AlertDialogPrimitive.Title + data-slot="alert-dialog-title" + className={cn("text-lg font-semibold", className)} + {...props} + /> + ) +} + +function AlertDialogDescription({ + className, + ...props +}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) { + return ( + <AlertDialogPrimitive.Description + data-slot="alert-dialog-description" + className={cn("text-muted-foreground text-sm", className)} + {...props} + /> + ) +} + +function AlertDialogAction({ + className, + ...props +}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) { + return ( + <AlertDialogPrimitive.Action + className={cn(buttonVariants(), className)} + {...props} + /> + ) +} + +function AlertDialogCancel({ + className, + ...props +}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) { + return ( + <AlertDialogPrimitive.Cancel + className={cn(buttonVariants({ variant: "outline" }), className)} + {...props} + /> + ) +} + +export { + AlertDialog, + AlertDialogPortal, + AlertDialogOverlay, + AlertDialogTrigger, + AlertDialogContent, + AlertDialogHeader, + AlertDialogFooter, + AlertDialogTitle, + AlertDialogDescription, + AlertDialogAction, + AlertDialogCancel, +} diff --git a/src/components/ui/alert.tsx b/src/components/ui/alert.tsx new file mode 100644 index 0000000..1421354 --- /dev/null +++ b/src/components/ui/alert.tsx @@ -0,0 +1,66 @@ +import * as React from "react" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" + +const alertVariants = cva( + "relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current", + { + variants: { + variant: { + default: "bg-card text-card-foreground", + destructive: + "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90", + }, + }, + defaultVariants: { + variant: "default", + }, + } +) + +function Alert({ + className, + variant, + ...props +}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) { + return ( + <div + data-slot="alert" + role="alert" + className={cn(alertVariants({ variant }), className)} + {...props} + /> + ) +} + +function AlertTitle({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="alert-title" + className={cn( + "col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight", + className + )} + {...props} + /> + ) +} + +function AlertDescription({ + className, + ...props +}: React.ComponentProps<"div">) { + return ( + <div + data-slot="alert-description" + className={cn( + "text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed", + className + )} + {...props} + /> + ) +} + +export { Alert, AlertTitle, AlertDescription } diff --git a/src/components/ui/aspect-ratio.tsx b/src/components/ui/aspect-ratio.tsx new file mode 100644 index 0000000..9b491fb --- /dev/null +++ b/src/components/ui/aspect-ratio.tsx @@ -0,0 +1,9 @@ +import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio" + +function AspectRatio({ + ...props +}: React.ComponentProps<typeof AspectRatioPrimitive.Root>) { + return <AspectRatioPrimitive.Root data-slot="aspect-ratio" {...props} /> +} + +export { AspectRatio } diff --git a/src/components/ui/avatar.tsx b/src/components/ui/avatar.tsx new file mode 100644 index 0000000..71e428b --- /dev/null +++ b/src/components/ui/avatar.tsx @@ -0,0 +1,53 @@ +"use client" + +import * as React from "react" +import * as AvatarPrimitive from "@radix-ui/react-avatar" + +import { cn } from "@/lib/utils" + +function Avatar({ + className, + ...props +}: React.ComponentProps<typeof AvatarPrimitive.Root>) { + return ( + <AvatarPrimitive.Root + data-slot="avatar" + className={cn( + "relative flex size-8 shrink-0 overflow-hidden rounded-full", + className + )} + {...props} + /> + ) +} + +function AvatarImage({ + className, + ...props +}: React.ComponentProps<typeof AvatarPrimitive.Image>) { + return ( + <AvatarPrimitive.Image + data-slot="avatar-image" + className={cn("aspect-square size-full", className)} + {...props} + /> + ) +} + +function AvatarFallback({ + className, + ...props +}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) { + return ( + <AvatarPrimitive.Fallback + data-slot="avatar-fallback" + className={cn( + "bg-muted flex size-full items-center justify-center rounded-full", + className + )} + {...props} + /> + ) +} + +export { Avatar, AvatarImage, AvatarFallback } diff --git a/src/components/ui/badge.tsx b/src/components/ui/badge.tsx new file mode 100644 index 0000000..0205413 --- /dev/null +++ b/src/components/ui/badge.tsx @@ -0,0 +1,46 @@ +import * as React from "react" +import { Slot } from "@radix-ui/react-slot" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" + +const badgeVariants = cva( + "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden", + { + variants: { + variant: { + default: + "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90", + secondary: + "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90", + destructive: + "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60", + outline: + "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground", + }, + }, + defaultVariants: { + variant: "default", + }, + } +) + +function Badge({ + className, + variant, + asChild = false, + ...props +}: React.ComponentProps<"span"> & + VariantProps<typeof badgeVariants> & { asChild?: boolean }) { + const Comp = asChild ? Slot : "span" + + return ( + <Comp + data-slot="badge" + className={cn(badgeVariants({ variant }), className)} + {...props} + /> + ) +} + +export { Badge, badgeVariants } diff --git a/src/components/ui/breadcrumb.tsx b/src/components/ui/breadcrumb.tsx new file mode 100644 index 0000000..eb88f32 --- /dev/null +++ b/src/components/ui/breadcrumb.tsx @@ -0,0 +1,109 @@ +import * as React from "react" +import { Slot } from "@radix-ui/react-slot" +import { ChevronRight, MoreHorizontal } from "lucide-react" + +import { cn } from "@/lib/utils" + +function Breadcrumb({ ...props }: React.ComponentProps<"nav">) { + return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} /> +} + +function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) { + return ( + <ol + data-slot="breadcrumb-list" + className={cn( + "text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5", + className + )} + {...props} + /> + ) +} + +function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) { + return ( + <li + data-slot="breadcrumb-item" + className={cn("inline-flex items-center gap-1.5", className)} + {...props} + /> + ) +} + +function BreadcrumbLink({ + asChild, + className, + ...props +}: React.ComponentProps<"a"> & { + asChild?: boolean +}) { + const Comp = asChild ? Slot : "a" + + return ( + <Comp + data-slot="breadcrumb-link" + className={cn("hover:text-foreground transition-colors", className)} + {...props} + /> + ) +} + +function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) { + return ( + <span + data-slot="breadcrumb-page" + role="link" + aria-disabled="true" + aria-current="page" + className={cn("text-foreground font-normal", className)} + {...props} + /> + ) +} + +function BreadcrumbSeparator({ + children, + className, + ...props +}: React.ComponentProps<"li">) { + return ( + <li + data-slot="breadcrumb-separator" + role="presentation" + aria-hidden="true" + className={cn("[&>svg]:size-3.5", className)} + {...props} + > + {children ?? <ChevronRight />} + </li> + ) +} + +function BreadcrumbEllipsis({ + className, + ...props +}: React.ComponentProps<"span">) { + return ( + <span + data-slot="breadcrumb-ellipsis" + role="presentation" + aria-hidden="true" + className={cn("flex size-9 items-center justify-center", className)} + {...props} + > + <MoreHorizontal className="size-4" /> + <span className="sr-only">More</span> + </span> + ) +} + +export { + Breadcrumb, + BreadcrumbList, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbPage, + BreadcrumbSeparator, + BreadcrumbEllipsis, +} diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx new file mode 100644 index 0000000..a2df8dc --- /dev/null +++ b/src/components/ui/button.tsx @@ -0,0 +1,59 @@ +import * as React from "react" +import { Slot } from "@radix-ui/react-slot" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" + +const buttonVariants = cva( + "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", + { + variants: { + variant: { + default: + "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90", + destructive: + "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60", + outline: + "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50", + secondary: + "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80", + ghost: + "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50", + link: "text-primary underline-offset-4 hover:underline", + }, + size: { + default: "h-9 px-4 py-2 has-[>svg]:px-3", + sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5", + lg: "h-10 rounded-md px-6 has-[>svg]:px-4", + icon: "size-9", + }, + }, + defaultVariants: { + variant: "default", + size: "default", + }, + } +) + +function Button({ + className, + variant, + size, + asChild = false, + ...props +}: React.ComponentProps<"button"> & + VariantProps<typeof buttonVariants> & { + asChild?: boolean + }) { + const Comp = asChild ? Slot : "button" + + return ( + <Comp + data-slot="button" + className={cn(buttonVariants({ variant, size, className }))} + {...props} + /> + ) +} + +export { Button, buttonVariants } diff --git a/src/components/ui/calendar.tsx b/src/components/ui/calendar.tsx new file mode 100644 index 0000000..3976ece --- /dev/null +++ b/src/components/ui/calendar.tsx @@ -0,0 +1,73 @@ +import * as React from "react" +import { ChevronLeft, ChevronRight } from "lucide-react" +import { DayPicker } from "react-day-picker" + +import { cn } from "@/lib/utils" +import { buttonVariants } from "@/components/ui/button" + +function Calendar({ + className, + classNames, + showOutsideDays = true, + ...props +}: React.ComponentProps<typeof DayPicker>) { + return ( + <DayPicker + showOutsideDays={showOutsideDays} + className={cn("p-3", className)} + classNames={{ + months: "flex flex-col sm:flex-row gap-2", + month: "flex flex-col gap-4", + caption: "flex justify-center pt-1 relative items-center w-full", + caption_label: "text-sm font-medium", + nav: "flex items-center gap-1", + nav_button: cn( + buttonVariants({ variant: "outline" }), + "size-7 bg-transparent p-0 opacity-50 hover:opacity-100" + ), + nav_button_previous: "absolute left-1", + nav_button_next: "absolute right-1", + table: "w-full border-collapse space-x-1", + head_row: "flex", + head_cell: + "text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]", + row: "flex w-full mt-2", + cell: cn( + "relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md", + props.mode === "range" + ? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md" + : "[&:has([aria-selected])]:rounded-md" + ), + day: cn( + buttonVariants({ variant: "ghost" }), + "size-8 p-0 font-normal aria-selected:opacity-100" + ), + day_range_start: + "day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground", + day_range_end: + "day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground", + day_selected: + "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground", + day_today: "bg-accent text-accent-foreground", + day_outside: + "day-outside text-muted-foreground aria-selected:text-muted-foreground", + day_disabled: "text-muted-foreground opacity-50", + day_range_middle: + "aria-selected:bg-accent aria-selected:text-accent-foreground", + day_hidden: "invisible", + ...classNames, + }} + components={{ + IconLeft: ({ className, ...props }) => ( + <ChevronLeft className={cn("size-4", className)} {...props} /> + ), + IconRight: ({ className, ...props }) => ( + <ChevronRight className={cn("size-4", className)} {...props} /> + ), + }} + {...props} + /> + ) +} + +export { Calendar } diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx new file mode 100644 index 0000000..d05bbc6 --- /dev/null +++ b/src/components/ui/card.tsx @@ -0,0 +1,92 @@ +import * as React from "react" + +import { cn } from "@/lib/utils" + +function Card({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="card" + className={cn( + "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm", + className + )} + {...props} + /> + ) +} + +function CardHeader({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="card-header" + className={cn( + "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6", + className + )} + {...props} + /> + ) +} + +function CardTitle({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="card-title" + className={cn("leading-none font-semibold", className)} + {...props} + /> + ) +} + +function CardDescription({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="card-description" + className={cn("text-muted-foreground text-sm", className)} + {...props} + /> + ) +} + +function CardAction({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="card-action" + className={cn( + "col-start-2 row-span-2 row-start-1 self-start justify-self-end", + className + )} + {...props} + /> + ) +} + +function CardContent({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="card-content" + className={cn("px-6", className)} + {...props} + /> + ) +} + +function CardFooter({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="card-footer" + className={cn("flex items-center px-6 [.border-t]:pt-6", className)} + {...props} + /> + ) +} + +export { + Card, + CardHeader, + CardFooter, + CardTitle, + CardAction, + CardDescription, + CardContent, +} diff --git a/src/components/ui/carousel.tsx b/src/components/ui/carousel.tsx new file mode 100644 index 0000000..0e05a77 --- /dev/null +++ b/src/components/ui/carousel.tsx @@ -0,0 +1,241 @@ +"use client" + +import * as React from "react" +import useEmblaCarousel, { + type UseEmblaCarouselType, +} from "embla-carousel-react" +import { ArrowLeft, ArrowRight } from "lucide-react" + +import { cn } from "@/lib/utils" +import { Button } from "@/components/ui/button" + +type CarouselApi = UseEmblaCarouselType[1] +type UseCarouselParameters = Parameters<typeof useEmblaCarousel> +type CarouselOptions = UseCarouselParameters[0] +type CarouselPlugin = UseCarouselParameters[1] + +type CarouselProps = { + opts?: CarouselOptions + plugins?: CarouselPlugin + orientation?: "horizontal" | "vertical" + setApi?: (api: CarouselApi) => void +} + +type CarouselContextProps = { + carouselRef: ReturnType<typeof useEmblaCarousel>[0] + api: ReturnType<typeof useEmblaCarousel>[1] + scrollPrev: () => void + scrollNext: () => void + canScrollPrev: boolean + canScrollNext: boolean +} & CarouselProps + +const CarouselContext = React.createContext<CarouselContextProps | null>(null) + +function useCarousel() { + const context = React.useContext(CarouselContext) + + if (!context) { + throw new Error("useCarousel must be used within a <Carousel />") + } + + return context +} + +function Carousel({ + orientation = "horizontal", + opts, + setApi, + plugins, + className, + children, + ...props +}: React.ComponentProps<"div"> & CarouselProps) { + const [carouselRef, api] = useEmblaCarousel( + { + ...opts, + axis: orientation === "horizontal" ? "x" : "y", + }, + plugins + ) + const [canScrollPrev, setCanScrollPrev] = React.useState(false) + const [canScrollNext, setCanScrollNext] = React.useState(false) + + const onSelect = React.useCallback((api: CarouselApi) => { + if (!api) return + setCanScrollPrev(api.canScrollPrev()) + setCanScrollNext(api.canScrollNext()) + }, []) + + const scrollPrev = React.useCallback(() => { + api?.scrollPrev() + }, [api]) + + const scrollNext = React.useCallback(() => { + api?.scrollNext() + }, [api]) + + const handleKeyDown = React.useCallback( + (event: React.KeyboardEvent<HTMLDivElement>) => { + if (event.key === "ArrowLeft") { + event.preventDefault() + scrollPrev() + } else if (event.key === "ArrowRight") { + event.preventDefault() + scrollNext() + } + }, + [scrollPrev, scrollNext] + ) + + React.useEffect(() => { + if (!api || !setApi) return + setApi(api) + }, [api, setApi]) + + React.useEffect(() => { + if (!api) return + onSelect(api) + api.on("reInit", onSelect) + api.on("select", onSelect) + + return () => { + api?.off("select", onSelect) + } + }, [api, onSelect]) + + return ( + <CarouselContext.Provider + value={{ + carouselRef, + api: api, + opts, + orientation: + orientation || (opts?.axis === "y" ? "vertical" : "horizontal"), + scrollPrev, + scrollNext, + canScrollPrev, + canScrollNext, + }} + > + <div + onKeyDownCapture={handleKeyDown} + className={cn("relative", className)} + role="region" + aria-roledescription="carousel" + data-slot="carousel" + {...props} + > + {children} + </div> + </CarouselContext.Provider> + ) +} + +function CarouselContent({ className, ...props }: React.ComponentProps<"div">) { + const { carouselRef, orientation } = useCarousel() + + return ( + <div + ref={carouselRef} + className="overflow-hidden" + data-slot="carousel-content" + > + <div + className={cn( + "flex", + orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", + className + )} + {...props} + /> + </div> + ) +} + +function CarouselItem({ className, ...props }: React.ComponentProps<"div">) { + const { orientation } = useCarousel() + + return ( + <div + role="group" + aria-roledescription="slide" + data-slot="carousel-item" + className={cn( + "min-w-0 shrink-0 grow-0 basis-full", + orientation === "horizontal" ? "pl-4" : "pt-4", + className + )} + {...props} + /> + ) +} + +function CarouselPrevious({ + className, + variant = "outline", + size = "icon", + ...props +}: React.ComponentProps<typeof Button>) { + const { orientation, scrollPrev, canScrollPrev } = useCarousel() + + return ( + <Button + data-slot="carousel-previous" + variant={variant} + size={size} + className={cn( + "absolute size-8 rounded-full", + orientation === "horizontal" + ? "top-1/2 -left-12 -translate-y-1/2" + : "-top-12 left-1/2 -translate-x-1/2 rotate-90", + className + )} + disabled={!canScrollPrev} + onClick={scrollPrev} + {...props} + > + <ArrowLeft /> + <span className="sr-only">Previous slide</span> + </Button> + ) +} + +function CarouselNext({ + className, + variant = "outline", + size = "icon", + ...props +}: React.ComponentProps<typeof Button>) { + const { orientation, scrollNext, canScrollNext } = useCarousel() + + return ( + <Button + data-slot="carousel-next" + variant={variant} + size={size} + className={cn( + "absolute size-8 rounded-full", + orientation === "horizontal" + ? "top-1/2 -right-12 -translate-y-1/2" + : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", + className + )} + disabled={!canScrollNext} + onClick={scrollNext} + {...props} + > + <ArrowRight /> + <span className="sr-only">Next slide</span> + </Button> + ) +} + +export { + type CarouselApi, + Carousel, + CarouselContent, + CarouselItem, + CarouselPrevious, + CarouselNext, +} diff --git a/src/components/ui/chart.tsx b/src/components/ui/chart.tsx new file mode 100644 index 0000000..e4589f0 --- /dev/null +++ b/src/components/ui/chart.tsx @@ -0,0 +1,351 @@ +import * as React from "react" +import * as RechartsPrimitive from "recharts" + +import { cn } from "@/lib/utils" + +// Format: { THEME_NAME: CSS_SELECTOR } +const THEMES = { light: "", dark: ".dark" } as const + +export type ChartConfig = { + [k in string]: { + label?: React.ReactNode + icon?: React.ComponentType + } & ( + | { color?: string; theme?: never } + | { color?: never; theme: Record<keyof typeof THEMES, string> } + ) +} + +type ChartContextProps = { + config: ChartConfig +} + +const ChartContext = React.createContext<ChartContextProps | null>(null) + +function useChart() { + const context = React.useContext(ChartContext) + + if (!context) { + throw new Error("useChart must be used within a <ChartContainer />") + } + + return context +} + +function ChartContainer({ + id, + className, + children, + config, + ...props +}: React.ComponentProps<"div"> & { + config: ChartConfig + children: React.ComponentProps< + typeof RechartsPrimitive.ResponsiveContainer + >["children"] +}) { + const uniqueId = React.useId() + const chartId = `chart-${id || uniqueId.replace(/:/g, "")}` + + return ( + <ChartContext.Provider value={{ config }}> + <div + data-slot="chart" + data-chart={chartId} + className={cn( + "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", + className + )} + {...props} + > + <ChartStyle id={chartId} config={config} /> + <RechartsPrimitive.ResponsiveContainer> + {children} + </RechartsPrimitive.ResponsiveContainer> + </div> + </ChartContext.Provider> + ) +} + +const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => { + const colorConfig = Object.entries(config).filter( + ([, config]) => config.theme || config.color + ) + + if (!colorConfig.length) { + return null + } + + return ( + <style + dangerouslySetInnerHTML={{ + __html: Object.entries(THEMES) + .map( + ([theme, prefix]) => ` +${prefix} [data-chart=${id}] { +${colorConfig + .map(([key, itemConfig]) => { + const color = + itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || + itemConfig.color + return color ? ` --color-${key}: ${color};` : null + }) + .join("\n")} +} +` + ) + .join("\n"), + }} + /> + ) +} + +const ChartTooltip = RechartsPrimitive.Tooltip + +function ChartTooltipContent({ + active, + payload, + className, + indicator = "dot", + hideLabel = false, + hideIndicator = false, + label, + labelFormatter, + labelClassName, + formatter, + color, + nameKey, + labelKey, +}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> & + React.ComponentProps<"div"> & { + hideLabel?: boolean + hideIndicator?: boolean + indicator?: "line" | "dot" | "dashed" + nameKey?: string + labelKey?: string + }) { + const { config } = useChart() + + const tooltipLabel = React.useMemo(() => { + if (hideLabel || !payload?.length) { + return null + } + + const [item] = payload + const key = `${labelKey || item?.dataKey || item?.name || "value"}` + const itemConfig = getPayloadConfigFromPayload(config, item, key) + const value = + !labelKey && typeof label === "string" + ? config[label as keyof typeof config]?.label || label + : itemConfig?.label + + if (labelFormatter) { + return ( + <div className={cn("font-medium", labelClassName)}> + {labelFormatter(value, payload)} + </div> + ) + } + + if (!value) { + return null + } + + return <div className={cn("font-medium", labelClassName)}>{value}</div> + }, [ + label, + labelFormatter, + payload, + hideLabel, + labelClassName, + config, + labelKey, + ]) + + if (!active || !payload?.length) { + return null + } + + const nestLabel = payload.length === 1 && indicator !== "dot" + + return ( + <div + className={cn( + "border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl", + className + )} + > + {!nestLabel ? tooltipLabel : null} + <div className="grid gap-1.5"> + {payload.map((item, index) => { + const key = `${nameKey || item.name || item.dataKey || "value"}` + const itemConfig = getPayloadConfigFromPayload(config, item, key) + const indicatorColor = color || item.payload.fill || item.color + + return ( + <div + key={item.dataKey} + className={cn( + "[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", + indicator === "dot" && "items-center" + )} + > + {formatter && item?.value !== undefined && item.name ? ( + formatter(item.value, item.name, item, index, item.payload) + ) : ( + <> + {itemConfig?.icon ? ( + <itemConfig.icon /> + ) : ( + !hideIndicator && ( + <div + className={cn( + "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", + { + "h-2.5 w-2.5": indicator === "dot", + "w-1": indicator === "line", + "w-0 border-[1.5px] border-dashed bg-transparent": + indicator === "dashed", + "my-0.5": nestLabel && indicator === "dashed", + } + )} + style={ + { + "--color-bg": indicatorColor, + "--color-border": indicatorColor, + } as React.CSSProperties + } + /> + ) + )} + <div + className={cn( + "flex flex-1 justify-between leading-none", + nestLabel ? "items-end" : "items-center" + )} + > + <div className="grid gap-1.5"> + {nestLabel ? tooltipLabel : null} + <span className="text-muted-foreground"> + {itemConfig?.label || item.name} + </span> + </div> + {item.value && ( + <span className="text-foreground font-mono font-medium tabular-nums"> + {item.value.toLocaleString()} + </span> + )} + </div> + </> + )} + </div> + ) + })} + </div> + </div> + ) +} + +const ChartLegend = RechartsPrimitive.Legend + +function ChartLegendContent({ + className, + hideIcon = false, + payload, + verticalAlign = "bottom", + nameKey, +}: React.ComponentProps<"div"> & + Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & { + hideIcon?: boolean + nameKey?: string + }) { + const { config } = useChart() + + if (!payload?.length) { + return null + } + + return ( + <div + className={cn( + "flex items-center justify-center gap-4", + verticalAlign === "top" ? "pb-3" : "pt-3", + className + )} + > + {payload.map((item) => { + const key = `${nameKey || item.dataKey || "value"}` + const itemConfig = getPayloadConfigFromPayload(config, item, key) + + return ( + <div + key={item.value} + className={cn( + "[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3" + )} + > + {itemConfig?.icon && !hideIcon ? ( + <itemConfig.icon /> + ) : ( + <div + className="h-2 w-2 shrink-0 rounded-[2px]" + style={{ + backgroundColor: item.color, + }} + /> + )} + {itemConfig?.label} + </div> + ) + })} + </div> + ) +} + +// Helper to extract item config from a payload. +function getPayloadConfigFromPayload( + config: ChartConfig, + payload: unknown, + key: string +) { + if (typeof payload !== "object" || payload === null) { + return undefined + } + + const payloadPayload = + "payload" in payload && + typeof payload.payload === "object" && + payload.payload !== null + ? payload.payload + : undefined + + let configLabelKey: string = key + + if ( + key in payload && + typeof payload[key as keyof typeof payload] === "string" + ) { + configLabelKey = payload[key as keyof typeof payload] as string + } else if ( + payloadPayload && + key in payloadPayload && + typeof payloadPayload[key as keyof typeof payloadPayload] === "string" + ) { + configLabelKey = payloadPayload[ + key as keyof typeof payloadPayload + ] as string + } + + return configLabelKey in config + ? config[configLabelKey] + : config[key as keyof typeof config] +} + +export { + ChartContainer, + ChartTooltip, + ChartTooltipContent, + ChartLegend, + ChartLegendContent, + ChartStyle, +} diff --git a/src/components/ui/checkbox.tsx b/src/components/ui/checkbox.tsx new file mode 100644 index 0000000..fa0e4b5 --- /dev/null +++ b/src/components/ui/checkbox.tsx @@ -0,0 +1,32 @@ +"use client" + +import * as React from "react" +import * as CheckboxPrimitive from "@radix-ui/react-checkbox" +import { CheckIcon } from "lucide-react" + +import { cn } from "@/lib/utils" + +function Checkbox({ + className, + ...props +}: React.ComponentProps<typeof CheckboxPrimitive.Root>) { + return ( + <CheckboxPrimitive.Root + data-slot="checkbox" + className={cn( + "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", + className + )} + {...props} + > + <CheckboxPrimitive.Indicator + data-slot="checkbox-indicator" + className="flex items-center justify-center text-current transition-none" + > + <CheckIcon className="size-3.5" /> + </CheckboxPrimitive.Indicator> + </CheckboxPrimitive.Root> + ) +} + +export { Checkbox } diff --git a/src/components/ui/collapsible.tsx b/src/components/ui/collapsible.tsx new file mode 100644 index 0000000..77f86be --- /dev/null +++ b/src/components/ui/collapsible.tsx @@ -0,0 +1,31 @@ +import * as CollapsiblePrimitive from "@radix-ui/react-collapsible" + +function Collapsible({ + ...props +}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) { + return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} /> +} + +function CollapsibleTrigger({ + ...props +}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) { + return ( + <CollapsiblePrimitive.CollapsibleTrigger + data-slot="collapsible-trigger" + {...props} + /> + ) +} + +function CollapsibleContent({ + ...props +}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) { + return ( + <CollapsiblePrimitive.CollapsibleContent + data-slot="collapsible-content" + {...props} + /> + ) +} + +export { Collapsible, CollapsibleTrigger, CollapsibleContent } diff --git a/src/components/ui/command.tsx b/src/components/ui/command.tsx new file mode 100644 index 0000000..4ca5349 --- /dev/null +++ b/src/components/ui/command.tsx @@ -0,0 +1,177 @@ +"use client" + +import * as React from "react" +import { Command as CommandPrimitive } from "cmdk" +import { SearchIcon } from "lucide-react" + +import { cn } from "@/lib/utils" +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog" + +function Command({ + className, + ...props +}: React.ComponentProps<typeof CommandPrimitive>) { + return ( + <CommandPrimitive + data-slot="command" + className={cn( + "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md", + className + )} + {...props} + /> + ) +} + +function CommandDialog({ + title = "Command Palette", + description = "Search for a command to run...", + children, + ...props +}: React.ComponentProps<typeof Dialog> & { + title?: string + description?: string +}) { + return ( + <Dialog {...props}> + <DialogHeader className="sr-only"> + <DialogTitle>{title}</DialogTitle> + <DialogDescription>{description}</DialogDescription> + </DialogHeader> + <DialogContent className="overflow-hidden p-0"> + <Command className="[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5"> + {children} + </Command> + </DialogContent> + </Dialog> + ) +} + +function CommandInput({ + className, + ...props +}: React.ComponentProps<typeof CommandPrimitive.Input>) { + return ( + <div + data-slot="command-input-wrapper" + className="flex h-9 items-center gap-2 border-b px-3" + > + <SearchIcon className="size-4 shrink-0 opacity-50" /> + <CommandPrimitive.Input + data-slot="command-input" + className={cn( + "placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", + className + )} + {...props} + /> + </div> + ) +} + +function CommandList({ + className, + ...props +}: React.ComponentProps<typeof CommandPrimitive.List>) { + return ( + <CommandPrimitive.List + data-slot="command-list" + className={cn( + "max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", + className + )} + {...props} + /> + ) +} + +function CommandEmpty({ + ...props +}: React.ComponentProps<typeof CommandPrimitive.Empty>) { + return ( + <CommandPrimitive.Empty + data-slot="command-empty" + className="py-6 text-center text-sm" + {...props} + /> + ) +} + +function CommandGroup({ + className, + ...props +}: React.ComponentProps<typeof CommandPrimitive.Group>) { + return ( + <CommandPrimitive.Group + data-slot="command-group" + className={cn( + "text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium", + className + )} + {...props} + /> + ) +} + +function CommandSeparator({ + className, + ...props +}: React.ComponentProps<typeof CommandPrimitive.Separator>) { + return ( + <CommandPrimitive.Separator + data-slot="command-separator" + className={cn("bg-border -mx-1 h-px", className)} + {...props} + /> + ) +} + +function CommandItem({ + className, + ...props +}: React.ComponentProps<typeof CommandPrimitive.Item>) { + return ( + <CommandPrimitive.Item + data-slot="command-item" + className={cn( + "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + className + )} + {...props} + /> + ) +} + +function CommandShortcut({ + className, + ...props +}: React.ComponentProps<"span">) { + return ( + <span + data-slot="command-shortcut" + className={cn( + "text-muted-foreground ml-auto text-xs tracking-widest", + className + )} + {...props} + /> + ) +} + +export { + Command, + CommandDialog, + CommandInput, + CommandList, + CommandEmpty, + CommandGroup, + CommandItem, + CommandShortcut, + CommandSeparator, +} diff --git a/src/components/ui/context-menu.tsx b/src/components/ui/context-menu.tsx new file mode 100644 index 0000000..e29ad05 --- /dev/null +++ b/src/components/ui/context-menu.tsx @@ -0,0 +1,252 @@ +"use client" + +import * as React from "react" +import * as ContextMenuPrimitive from "@radix-ui/react-context-menu" +import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react" + +import { cn } from "@/lib/utils" + +function ContextMenu({ + ...props +}: React.ComponentProps<typeof ContextMenuPrimitive.Root>) { + return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} /> +} + +function ContextMenuTrigger({ + ...props +}: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) { + return ( + <ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} /> + ) +} + +function ContextMenuGroup({ + ...props +}: React.ComponentProps<typeof ContextMenuPrimitive.Group>) { + return ( + <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} /> + ) +} + +function ContextMenuPortal({ + ...props +}: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) { + return ( + <ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} /> + ) +} + +function ContextMenuSub({ + ...props +}: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) { + return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} /> +} + +function ContextMenuRadioGroup({ + ...props +}: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) { + return ( + <ContextMenuPrimitive.RadioGroup + data-slot="context-menu-radio-group" + {...props} + /> + ) +} + +function ContextMenuSubTrigger({ + className, + inset, + children, + ...props +}: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & { + inset?: boolean +}) { + return ( + <ContextMenuPrimitive.SubTrigger + data-slot="context-menu-sub-trigger" + data-inset={inset} + className={cn( + "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + className + )} + {...props} + > + {children} + <ChevronRightIcon className="ml-auto" /> + </ContextMenuPrimitive.SubTrigger> + ) +} + +function ContextMenuSubContent({ + className, + ...props +}: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) { + return ( + <ContextMenuPrimitive.SubContent + data-slot="context-menu-sub-content" + className={cn( + "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg", + className + )} + {...props} + /> + ) +} + +function ContextMenuContent({ + className, + ...props +}: React.ComponentProps<typeof ContextMenuPrimitive.Content>) { + return ( + <ContextMenuPrimitive.Portal> + <ContextMenuPrimitive.Content + data-slot="context-menu-content" + className={cn( + "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md", + className + )} + {...props} + /> + </ContextMenuPrimitive.Portal> + ) +} + +function ContextMenuItem({ + className, + inset, + variant = "default", + ...props +}: React.ComponentProps<typeof ContextMenuPrimitive.Item> & { + inset?: boolean + variant?: "default" | "destructive" +}) { + return ( + <ContextMenuPrimitive.Item + data-slot="context-menu-item" + data-inset={inset} + data-variant={variant} + className={cn( + "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + className + )} + {...props} + /> + ) +} + +function ContextMenuCheckboxItem({ + className, + children, + checked, + ...props +}: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) { + return ( + <ContextMenuPrimitive.CheckboxItem + data-slot="context-menu-checkbox-item" + className={cn( + "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + className + )} + checked={checked} + {...props} + > + <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center"> + <ContextMenuPrimitive.ItemIndicator> + <CheckIcon className="size-4" /> + </ContextMenuPrimitive.ItemIndicator> + </span> + {children} + </ContextMenuPrimitive.CheckboxItem> + ) +} + +function ContextMenuRadioItem({ + className, + children, + ...props +}: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) { + return ( + <ContextMenuPrimitive.RadioItem + data-slot="context-menu-radio-item" + className={cn( + "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + className + )} + {...props} + > + <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center"> + <ContextMenuPrimitive.ItemIndicator> + <CircleIcon className="size-2 fill-current" /> + </ContextMenuPrimitive.ItemIndicator> + </span> + {children} + </ContextMenuPrimitive.RadioItem> + ) +} + +function ContextMenuLabel({ + className, + inset, + ...props +}: React.ComponentProps<typeof ContextMenuPrimitive.Label> & { + inset?: boolean +}) { + return ( + <ContextMenuPrimitive.Label + data-slot="context-menu-label" + data-inset={inset} + className={cn( + "text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", + className + )} + {...props} + /> + ) +} + +function ContextMenuSeparator({ + className, + ...props +}: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) { + return ( + <ContextMenuPrimitive.Separator + data-slot="context-menu-separator" + className={cn("bg-border -mx-1 my-1 h-px", className)} + {...props} + /> + ) +} + +function ContextMenuShortcut({ + className, + ...props +}: React.ComponentProps<"span">) { + return ( + <span + data-slot="context-menu-shortcut" + className={cn( + "text-muted-foreground ml-auto text-xs tracking-widest", + className + )} + {...props} + /> + ) +} + +export { + ContextMenu, + ContextMenuTrigger, + ContextMenuContent, + ContextMenuItem, + ContextMenuCheckboxItem, + ContextMenuRadioItem, + ContextMenuLabel, + ContextMenuSeparator, + ContextMenuShortcut, + ContextMenuGroup, + ContextMenuPortal, + ContextMenuSub, + ContextMenuSubContent, + ContextMenuSubTrigger, + ContextMenuRadioGroup, +} diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx new file mode 100644 index 0000000..981e999 --- /dev/null +++ b/src/components/ui/dialog.tsx @@ -0,0 +1,133 @@ +import * as React from "react" +import * as DialogPrimitive from "@radix-ui/react-dialog" +import { XIcon } from "lucide-react" + +import { cn } from "@/lib/utils" + +function Dialog({ + ...props +}: React.ComponentProps<typeof DialogPrimitive.Root>) { + return <DialogPrimitive.Root data-slot="dialog" {...props} /> +} + +function DialogTrigger({ + ...props +}: React.ComponentProps<typeof DialogPrimitive.Trigger>) { + return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} /> +} + +function DialogPortal({ + ...props +}: React.ComponentProps<typeof DialogPrimitive.Portal>) { + return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} /> +} + +function DialogClose({ + ...props +}: React.ComponentProps<typeof DialogPrimitive.Close>) { + return <DialogPrimitive.Close data-slot="dialog-close" {...props} /> +} + +function DialogOverlay({ + className, + ...props +}: React.ComponentProps<typeof DialogPrimitive.Overlay>) { + return ( + <DialogPrimitive.Overlay + data-slot="dialog-overlay" + className={cn( + "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", + className + )} + {...props} + /> + ) +} + +function DialogContent({ + className, + children, + ...props +}: React.ComponentProps<typeof DialogPrimitive.Content>) { + return ( + <DialogPortal data-slot="dialog-portal"> + <DialogOverlay /> + <DialogPrimitive.Content + data-slot="dialog-content" + className={cn( + "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg", + className + )} + {...props} + > + {children} + <DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"> + <XIcon /> + <span className="sr-only">Close</span> + </DialogPrimitive.Close> + </DialogPrimitive.Content> + </DialogPortal> + ) +} + +function DialogHeader({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="dialog-header" + className={cn("flex flex-col gap-2 text-center sm:text-left", className)} + {...props} + /> + ) +} + +function DialogFooter({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="dialog-footer" + className={cn( + "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", + className + )} + {...props} + /> + ) +} + +function DialogTitle({ + className, + ...props +}: React.ComponentProps<typeof DialogPrimitive.Title>) { + return ( + <DialogPrimitive.Title + data-slot="dialog-title" + className={cn("text-lg leading-none font-semibold", className)} + {...props} + /> + ) +} + +function DialogDescription({ + className, + ...props +}: React.ComponentProps<typeof DialogPrimitive.Description>) { + return ( + <DialogPrimitive.Description + data-slot="dialog-description" + className={cn("text-muted-foreground text-sm", className)} + {...props} + /> + ) +} + +export { + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogOverlay, + DialogPortal, + DialogTitle, + DialogTrigger, +} diff --git a/src/components/ui/drawer.tsx b/src/components/ui/drawer.tsx new file mode 100644 index 0000000..7fd2e98 --- /dev/null +++ b/src/components/ui/drawer.tsx @@ -0,0 +1,130 @@ +import * as React from "react" +import { Drawer as DrawerPrimitive } from "vaul" + +import { cn } from "@/lib/utils" + +function Drawer({ + ...props +}: React.ComponentProps<typeof DrawerPrimitive.Root>) { + return <DrawerPrimitive.Root data-slot="drawer" {...props} /> +} + +function DrawerTrigger({ + ...props +}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) { + return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} /> +} + +function DrawerPortal({ + ...props +}: React.ComponentProps<typeof DrawerPrimitive.Portal>) { + return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} /> +} + +function DrawerClose({ + ...props +}: React.ComponentProps<typeof DrawerPrimitive.Close>) { + return <DrawerPrimitive.Close data-slot="drawer-close" {...props} /> +} + +function DrawerOverlay({ + className, + ...props +}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) { + return ( + <DrawerPrimitive.Overlay + data-slot="drawer-overlay" + className={cn( + "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", + className + )} + {...props} + /> + ) +} + +function DrawerContent({ + className, + children, + ...props +}: React.ComponentProps<typeof DrawerPrimitive.Content>) { + return ( + <DrawerPortal data-slot="drawer-portal"> + <DrawerOverlay /> + <DrawerPrimitive.Content + data-slot="drawer-content" + className={cn( + "group/drawer-content bg-background fixed z-50 flex h-auto flex-col", + "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b", + "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t", + "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm", + "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm", + className + )} + {...props} + > + <div className="bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" /> + {children} + </DrawerPrimitive.Content> + </DrawerPortal> + ) +} + +function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="drawer-header" + className={cn("flex flex-col gap-1.5 p-4", className)} + {...props} + /> + ) +} + +function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="drawer-footer" + className={cn("mt-auto flex flex-col gap-2 p-4", className)} + {...props} + /> + ) +} + +function DrawerTitle({ + className, + ...props +}: React.ComponentProps<typeof DrawerPrimitive.Title>) { + return ( + <DrawerPrimitive.Title + data-slot="drawer-title" + className={cn("text-foreground font-semibold", className)} + {...props} + /> + ) +} + +function DrawerDescription({ + className, + ...props +}: React.ComponentProps<typeof DrawerPrimitive.Description>) { + return ( + <DrawerPrimitive.Description + data-slot="drawer-description" + className={cn("text-muted-foreground text-sm", className)} + {...props} + /> + ) +} + +export { + Drawer, + DrawerPortal, + DrawerOverlay, + DrawerTrigger, + DrawerClose, + DrawerContent, + DrawerHeader, + DrawerFooter, + DrawerTitle, + DrawerDescription, +} diff --git a/src/components/ui/dropdown-menu.tsx b/src/components/ui/dropdown-menu.tsx new file mode 100644 index 0000000..ec51e9c --- /dev/null +++ b/src/components/ui/dropdown-menu.tsx @@ -0,0 +1,257 @@ +"use client" + +import * as React from "react" +import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu" +import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react" + +import { cn } from "@/lib/utils" + +function DropdownMenu({ + ...props +}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) { + return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} /> +} + +function DropdownMenuPortal({ + ...props +}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) { + return ( + <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} /> + ) +} + +function DropdownMenuTrigger({ + ...props +}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) { + return ( + <DropdownMenuPrimitive.Trigger + data-slot="dropdown-menu-trigger" + {...props} + /> + ) +} + +function DropdownMenuContent({ + className, + sideOffset = 4, + ...props +}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) { + return ( + <DropdownMenuPrimitive.Portal> + <DropdownMenuPrimitive.Content + data-slot="dropdown-menu-content" + sideOffset={sideOffset} + className={cn( + "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md", + className + )} + {...props} + /> + </DropdownMenuPrimitive.Portal> + ) +} + +function DropdownMenuGroup({ + ...props +}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) { + return ( + <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} /> + ) +} + +function DropdownMenuItem({ + className, + inset, + variant = "default", + ...props +}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & { + inset?: boolean + variant?: "default" | "destructive" +}) { + return ( + <DropdownMenuPrimitive.Item + data-slot="dropdown-menu-item" + data-inset={inset} + data-variant={variant} + className={cn( + "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + className + )} + {...props} + /> + ) +} + +function DropdownMenuCheckboxItem({ + className, + children, + checked, + ...props +}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) { + return ( + <DropdownMenuPrimitive.CheckboxItem + data-slot="dropdown-menu-checkbox-item" + className={cn( + "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + className + )} + checked={checked} + {...props} + > + <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center"> + <DropdownMenuPrimitive.ItemIndicator> + <CheckIcon className="size-4" /> + </DropdownMenuPrimitive.ItemIndicator> + </span> + {children} + </DropdownMenuPrimitive.CheckboxItem> + ) +} + +function DropdownMenuRadioGroup({ + ...props +}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) { + return ( + <DropdownMenuPrimitive.RadioGroup + data-slot="dropdown-menu-radio-group" + {...props} + /> + ) +} + +function DropdownMenuRadioItem({ + className, + children, + ...props +}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) { + return ( + <DropdownMenuPrimitive.RadioItem + data-slot="dropdown-menu-radio-item" + className={cn( + "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + className + )} + {...props} + > + <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center"> + <DropdownMenuPrimitive.ItemIndicator> + <CircleIcon className="size-2 fill-current" /> + </DropdownMenuPrimitive.ItemIndicator> + </span> + {children} + </DropdownMenuPrimitive.RadioItem> + ) +} + +function DropdownMenuLabel({ + className, + inset, + ...props +}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & { + inset?: boolean +}) { + return ( + <DropdownMenuPrimitive.Label + data-slot="dropdown-menu-label" + data-inset={inset} + className={cn( + "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", + className + )} + {...props} + /> + ) +} + +function DropdownMenuSeparator({ + className, + ...props +}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) { + return ( + <DropdownMenuPrimitive.Separator + data-slot="dropdown-menu-separator" + className={cn("bg-border -mx-1 my-1 h-px", className)} + {...props} + /> + ) +} + +function DropdownMenuShortcut({ + className, + ...props +}: React.ComponentProps<"span">) { + return ( + <span + data-slot="dropdown-menu-shortcut" + className={cn( + "text-muted-foreground ml-auto text-xs tracking-widest", + className + )} + {...props} + /> + ) +} + +function DropdownMenuSub({ + ...props +}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) { + return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} /> +} + +function DropdownMenuSubTrigger({ + className, + inset, + children, + ...props +}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & { + inset?: boolean +}) { + return ( + <DropdownMenuPrimitive.SubTrigger + data-slot="dropdown-menu-sub-trigger" + data-inset={inset} + className={cn( + "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8", + className + )} + {...props} + > + {children} + <ChevronRightIcon className="ml-auto size-4" /> + </DropdownMenuPrimitive.SubTrigger> + ) +} + +function DropdownMenuSubContent({ + className, + ...props +}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) { + return ( + <DropdownMenuPrimitive.SubContent + data-slot="dropdown-menu-sub-content" + className={cn( + "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg", + className + )} + {...props} + /> + ) +} + +export { + DropdownMenu, + DropdownMenuPortal, + DropdownMenuTrigger, + DropdownMenuContent, + DropdownMenuGroup, + DropdownMenuLabel, + DropdownMenuItem, + DropdownMenuCheckboxItem, + DropdownMenuRadioGroup, + DropdownMenuRadioItem, + DropdownMenuSeparator, + DropdownMenuShortcut, + DropdownMenuSub, + DropdownMenuSubTrigger, + DropdownMenuSubContent, +} diff --git a/src/components/ui/form.tsx b/src/components/ui/form.tsx new file mode 100644 index 0000000..7d7474c --- /dev/null +++ b/src/components/ui/form.tsx @@ -0,0 +1,165 @@ +import * as React from "react" +import * as LabelPrimitive from "@radix-ui/react-label" +import { Slot } from "@radix-ui/react-slot" +import { + Controller, + FormProvider, + useFormContext, + useFormState, + type ControllerProps, + type FieldPath, + type FieldValues, +} from "react-hook-form" + +import { cn } from "@/lib/utils" +import { Label } from "@/components/ui/label" + +const Form = FormProvider + +type FormFieldContextValue< + TFieldValues extends FieldValues = FieldValues, + TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, +> = { + name: TName +} + +const FormFieldContext = React.createContext<FormFieldContextValue>( + {} as FormFieldContextValue +) + +const FormField = < + TFieldValues extends FieldValues = FieldValues, + TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, +>({ + ...props +}: ControllerProps<TFieldValues, TName>) => { + return ( + <FormFieldContext.Provider value={{ name: props.name }}> + <Controller {...props} /> + </FormFieldContext.Provider> + ) +} + +const useFormField = () => { + const fieldContext = React.useContext(FormFieldContext) + const itemContext = React.useContext(FormItemContext) + const { getFieldState } = useFormContext() + const formState = useFormState({ name: fieldContext.name }) + const fieldState = getFieldState(fieldContext.name, formState) + + if (!fieldContext) { + throw new Error("useFormField should be used within <FormField>") + } + + const { id } = itemContext + + return { + id, + name: fieldContext.name, + formItemId: `${id}-form-item`, + formDescriptionId: `${id}-form-item-description`, + formMessageId: `${id}-form-item-message`, + ...fieldState, + } +} + +type FormItemContextValue = { + id: string +} + +const FormItemContext = React.createContext<FormItemContextValue>( + {} as FormItemContextValue +) + +function FormItem({ className, ...props }: React.ComponentProps<"div">) { + const id = React.useId() + + return ( + <FormItemContext.Provider value={{ id }}> + <div + data-slot="form-item" + className={cn("grid gap-2", className)} + {...props} + /> + </FormItemContext.Provider> + ) +} + +function FormLabel({ + className, + ...props +}: React.ComponentProps<typeof LabelPrimitive.Root>) { + const { error, formItemId } = useFormField() + + return ( + <Label + data-slot="form-label" + data-error={!!error} + className={cn("data-[error=true]:text-destructive", className)} + htmlFor={formItemId} + {...props} + /> + ) +} + +function FormControl({ ...props }: React.ComponentProps<typeof Slot>) { + const { error, formItemId, formDescriptionId, formMessageId } = useFormField() + + return ( + <Slot + data-slot="form-control" + id={formItemId} + aria-describedby={ + !error + ? `${formDescriptionId}` + : `${formDescriptionId} ${formMessageId}` + } + aria-invalid={!!error} + {...props} + /> + ) +} + +function FormDescription({ className, ...props }: React.ComponentProps<"p">) { + const { formDescriptionId } = useFormField() + + return ( + <p + data-slot="form-description" + id={formDescriptionId} + className={cn("text-muted-foreground text-sm", className)} + {...props} + /> + ) +} + +function FormMessage({ className, ...props }: React.ComponentProps<"p">) { + const { error, formMessageId } = useFormField() + const body = error ? String(error?.message ?? "") : props.children + + if (!body) { + return null + } + + return ( + <p + data-slot="form-message" + id={formMessageId} + className={cn("text-destructive text-sm", className)} + {...props} + > + {body} + </p> + ) +} + +export { + useFormField, + Form, + FormItem, + FormLabel, + FormControl, + FormDescription, + FormMessage, + FormField, +} diff --git a/src/components/ui/hover-card.tsx b/src/components/ui/hover-card.tsx new file mode 100644 index 0000000..e4204e0 --- /dev/null +++ b/src/components/ui/hover-card.tsx @@ -0,0 +1,42 @@ +import * as React from "react" +import * as HoverCardPrimitive from "@radix-ui/react-hover-card" + +import { cn } from "@/lib/utils" + +function HoverCard({ + ...props +}: React.ComponentProps<typeof HoverCardPrimitive.Root>) { + return <HoverCardPrimitive.Root data-slot="hover-card" {...props} /> +} + +function HoverCardTrigger({ + ...props +}: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) { + return ( + <HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} /> + ) +} + +function HoverCardContent({ + className, + align = "center", + sideOffset = 4, + ...props +}: React.ComponentProps<typeof HoverCardPrimitive.Content>) { + return ( + <HoverCardPrimitive.Portal data-slot="hover-card-portal"> + <HoverCardPrimitive.Content + data-slot="hover-card-content" + align={align} + sideOffset={sideOffset} + className={cn( + "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden", + className + )} + {...props} + /> + </HoverCardPrimitive.Portal> + ) +} + +export { HoverCard, HoverCardTrigger, HoverCardContent } diff --git a/src/components/ui/input-otp.tsx b/src/components/ui/input-otp.tsx new file mode 100644 index 0000000..614f70e --- /dev/null +++ b/src/components/ui/input-otp.tsx @@ -0,0 +1,77 @@ +"use client" + +import * as React from "react" +import { OTPInput, OTPInputContext } from "input-otp" +import { MinusIcon } from "lucide-react" + +import { cn } from "@/lib/utils" + +function InputOTP({ + className, + containerClassName, + ...props +}: React.ComponentProps<typeof OTPInput> & { + containerClassName?: string +}) { + return ( + <OTPInput + data-slot="input-otp" + containerClassName={cn( + "flex items-center gap-2 has-disabled:opacity-50", + containerClassName + )} + className={cn("disabled:cursor-not-allowed", className)} + {...props} + /> + ) +} + +function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="input-otp-group" + className={cn("flex items-center", className)} + {...props} + /> + ) +} + +function InputOTPSlot({ + index, + className, + ...props +}: React.ComponentProps<"div"> & { + index: number +}) { + const inputOTPContext = React.useContext(OTPInputContext) + const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {} + + return ( + <div + data-slot="input-otp-slot" + data-active={isActive} + className={cn( + "data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]", + className + )} + {...props} + > + {char} + {hasFakeCaret && ( + <div className="pointer-events-none absolute inset-0 flex items-center justify-center"> + <div className="animate-caret-blink bg-foreground h-4 w-px duration-1000" /> + </div> + )} + </div> + ) +} + +function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) { + return ( + <div data-slot="input-otp-separator" role="separator" {...props}> + <MinusIcon /> + </div> + ) +} + +export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator } diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsx new file mode 100644 index 0000000..03295ca --- /dev/null +++ b/src/components/ui/input.tsx @@ -0,0 +1,21 @@ +import * as React from "react" + +import { cn } from "@/lib/utils" + +function Input({ className, type, ...props }: React.ComponentProps<"input">) { + return ( + <input + type={type} + data-slot="input" + className={cn( + "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", + "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", + "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", + className + )} + {...props} + /> + ) +} + +export { Input } diff --git a/src/components/ui/label.tsx b/src/components/ui/label.tsx new file mode 100644 index 0000000..fb5fbc3 --- /dev/null +++ b/src/components/ui/label.tsx @@ -0,0 +1,24 @@ +"use client" + +import * as React from "react" +import * as LabelPrimitive from "@radix-ui/react-label" + +import { cn } from "@/lib/utils" + +function Label({ + className, + ...props +}: React.ComponentProps<typeof LabelPrimitive.Root>) { + return ( + <LabelPrimitive.Root + data-slot="label" + className={cn( + "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", + className + )} + {...props} + /> + ) +} + +export { Label } diff --git a/src/components/ui/menubar.tsx b/src/components/ui/menubar.tsx new file mode 100644 index 0000000..cb45a86 --- /dev/null +++ b/src/components/ui/menubar.tsx @@ -0,0 +1,274 @@ +import * as React from "react" +import * as MenubarPrimitive from "@radix-ui/react-menubar" +import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react" + +import { cn } from "@/lib/utils" + +function Menubar({ + className, + ...props +}: React.ComponentProps<typeof MenubarPrimitive.Root>) { + return ( + <MenubarPrimitive.Root + data-slot="menubar" + className={cn( + "bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs", + className + )} + {...props} + /> + ) +} + +function MenubarMenu({ + ...props +}: React.ComponentProps<typeof MenubarPrimitive.Menu>) { + return <MenubarPrimitive.Menu data-slot="menubar-menu" {...props} /> +} + +function MenubarGroup({ + ...props +}: React.ComponentProps<typeof MenubarPrimitive.Group>) { + return <MenubarPrimitive.Group data-slot="menubar-group" {...props} /> +} + +function MenubarPortal({ + ...props +}: React.ComponentProps<typeof MenubarPrimitive.Portal>) { + return <MenubarPrimitive.Portal data-slot="menubar-portal" {...props} /> +} + +function MenubarRadioGroup({ + ...props +}: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) { + return ( + <MenubarPrimitive.RadioGroup data-slot="menubar-radio-group" {...props} /> + ) +} + +function MenubarTrigger({ + className, + ...props +}: React.ComponentProps<typeof MenubarPrimitive.Trigger>) { + return ( + <MenubarPrimitive.Trigger + data-slot="menubar-trigger" + className={cn( + "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none", + className + )} + {...props} + /> + ) +} + +function MenubarContent({ + className, + align = "start", + alignOffset = -4, + sideOffset = 8, + ...props +}: React.ComponentProps<typeof MenubarPrimitive.Content>) { + return ( + <MenubarPortal> + <MenubarPrimitive.Content + data-slot="menubar-content" + align={align} + alignOffset={alignOffset} + sideOffset={sideOffset} + className={cn( + "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[12rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-md", + className + )} + {...props} + /> + </MenubarPortal> + ) +} + +function MenubarItem({ + className, + inset, + variant = "default", + ...props +}: React.ComponentProps<typeof MenubarPrimitive.Item> & { + inset?: boolean + variant?: "default" | "destructive" +}) { + return ( + <MenubarPrimitive.Item + data-slot="menubar-item" + data-inset={inset} + data-variant={variant} + className={cn( + "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + className + )} + {...props} + /> + ) +} + +function MenubarCheckboxItem({ + className, + children, + checked, + ...props +}: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>) { + return ( + <MenubarPrimitive.CheckboxItem + data-slot="menubar-checkbox-item" + className={cn( + "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + className + )} + checked={checked} + {...props} + > + <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center"> + <MenubarPrimitive.ItemIndicator> + <CheckIcon className="size-4" /> + </MenubarPrimitive.ItemIndicator> + </span> + {children} + </MenubarPrimitive.CheckboxItem> + ) +} + +function MenubarRadioItem({ + className, + children, + ...props +}: React.ComponentProps<typeof MenubarPrimitive.RadioItem>) { + return ( + <MenubarPrimitive.RadioItem + data-slot="menubar-radio-item" + className={cn( + "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + className + )} + {...props} + > + <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center"> + <MenubarPrimitive.ItemIndicator> + <CircleIcon className="size-2 fill-current" /> + </MenubarPrimitive.ItemIndicator> + </span> + {children} + </MenubarPrimitive.RadioItem> + ) +} + +function MenubarLabel({ + className, + inset, + ...props +}: React.ComponentProps<typeof MenubarPrimitive.Label> & { + inset?: boolean +}) { + return ( + <MenubarPrimitive.Label + data-slot="menubar-label" + data-inset={inset} + className={cn( + "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", + className + )} + {...props} + /> + ) +} + +function MenubarSeparator({ + className, + ...props +}: React.ComponentProps<typeof MenubarPrimitive.Separator>) { + return ( + <MenubarPrimitive.Separator + data-slot="menubar-separator" + className={cn("bg-border -mx-1 my-1 h-px", className)} + {...props} + /> + ) +} + +function MenubarShortcut({ + className, + ...props +}: React.ComponentProps<"span">) { + return ( + <span + data-slot="menubar-shortcut" + className={cn( + "text-muted-foreground ml-auto text-xs tracking-widest", + className + )} + {...props} + /> + ) +} + +function MenubarSub({ + ...props +}: React.ComponentProps<typeof MenubarPrimitive.Sub>) { + return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} /> +} + +function MenubarSubTrigger({ + className, + inset, + children, + ...props +}: React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & { + inset?: boolean +}) { + return ( + <MenubarPrimitive.SubTrigger + data-slot="menubar-sub-trigger" + data-inset={inset} + className={cn( + "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[inset]:pl-8", + className + )} + {...props} + > + {children} + <ChevronRightIcon className="ml-auto h-4 w-4" /> + </MenubarPrimitive.SubTrigger> + ) +} + +function MenubarSubContent({ + className, + ...props +}: React.ComponentProps<typeof MenubarPrimitive.SubContent>) { + return ( + <MenubarPrimitive.SubContent + data-slot="menubar-sub-content" + className={cn( + "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg", + className + )} + {...props} + /> + ) +} + +export { + Menubar, + MenubarPortal, + MenubarMenu, + MenubarTrigger, + MenubarContent, + MenubarGroup, + MenubarSeparator, + MenubarLabel, + MenubarItem, + MenubarShortcut, + MenubarCheckboxItem, + MenubarRadioGroup, + MenubarRadioItem, + MenubarSub, + MenubarSubTrigger, + MenubarSubContent, +} diff --git a/src/components/ui/navigation-menu.tsx b/src/components/ui/navigation-menu.tsx new file mode 100644 index 0000000..1199945 --- /dev/null +++ b/src/components/ui/navigation-menu.tsx @@ -0,0 +1,168 @@ +import * as React from "react" +import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu" +import { cva } from "class-variance-authority" +import { ChevronDownIcon } from "lucide-react" + +import { cn } from "@/lib/utils" + +function NavigationMenu({ + className, + children, + viewport = true, + ...props +}: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & { + viewport?: boolean +}) { + return ( + <NavigationMenuPrimitive.Root + data-slot="navigation-menu" + data-viewport={viewport} + className={cn( + "group/navigation-menu relative flex max-w-max flex-1 items-center justify-center", + className + )} + {...props} + > + {children} + {viewport && <NavigationMenuViewport />} + </NavigationMenuPrimitive.Root> + ) +} + +function NavigationMenuList({ + className, + ...props +}: React.ComponentProps<typeof NavigationMenuPrimitive.List>) { + return ( + <NavigationMenuPrimitive.List + data-slot="navigation-menu-list" + className={cn( + "group flex flex-1 list-none items-center justify-center gap-1", + className + )} + {...props} + /> + ) +} + +function NavigationMenuItem({ + className, + ...props +}: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) { + return ( + <NavigationMenuPrimitive.Item + data-slot="navigation-menu-item" + className={cn("relative", className)} + {...props} + /> + ) +} + +const navigationMenuTriggerStyle = cva( + "group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1" +) + +function NavigationMenuTrigger({ + className, + children, + ...props +}: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) { + return ( + <NavigationMenuPrimitive.Trigger + data-slot="navigation-menu-trigger" + className={cn(navigationMenuTriggerStyle(), "group", className)} + {...props} + > + {children}{" "} + <ChevronDownIcon + className="relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180" + aria-hidden="true" + /> + </NavigationMenuPrimitive.Trigger> + ) +} + +function NavigationMenuContent({ + className, + ...props +}: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) { + return ( + <NavigationMenuPrimitive.Content + data-slot="navigation-menu-content" + className={cn( + "data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 top-0 left-0 w-full p-2 pr-2.5 md:absolute md:w-auto", + "group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none", + className + )} + {...props} + /> + ) +} + +function NavigationMenuViewport({ + className, + ...props +}: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) { + return ( + <div + className={cn( + "absolute top-full left-0 isolate z-50 flex justify-center" + )} + > + <NavigationMenuPrimitive.Viewport + data-slot="navigation-menu-viewport" + className={cn( + "origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]", + className + )} + {...props} + /> + </div> + ) +} + +function NavigationMenuLink({ + className, + ...props +}: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) { + return ( + <NavigationMenuPrimitive.Link + data-slot="navigation-menu-link" + className={cn( + "data-[active=true]:focus:bg-accent data-[active=true]:hover:bg-accent data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-ring/50 [&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4", + className + )} + {...props} + /> + ) +} + +function NavigationMenuIndicator({ + className, + ...props +}: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) { + return ( + <NavigationMenuPrimitive.Indicator + data-slot="navigation-menu-indicator" + className={cn( + "data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden", + className + )} + {...props} + > + <div className="bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" /> + </NavigationMenuPrimitive.Indicator> + ) +} + +export { + NavigationMenu, + NavigationMenuList, + NavigationMenuItem, + NavigationMenuContent, + NavigationMenuTrigger, + NavigationMenuLink, + NavigationMenuIndicator, + NavigationMenuViewport, + navigationMenuTriggerStyle, +} diff --git a/src/components/ui/pagination.tsx b/src/components/ui/pagination.tsx new file mode 100644 index 0000000..0d18541 --- /dev/null +++ b/src/components/ui/pagination.tsx @@ -0,0 +1,127 @@ +import * as React from "react" +import { + ChevronLeftIcon, + ChevronRightIcon, + MoreHorizontalIcon, +} from "lucide-react" + +import { cn } from "@/lib/utils" +import { Button, buttonVariants } from "@/components/ui/button" + +function Pagination({ className, ...props }: React.ComponentProps<"nav">) { + return ( + <nav + role="navigation" + aria-label="pagination" + data-slot="pagination" + className={cn("mx-auto flex w-full justify-center", className)} + {...props} + /> + ) +} + +function PaginationContent({ + className, + ...props +}: React.ComponentProps<"ul">) { + return ( + <ul + data-slot="pagination-content" + className={cn("flex flex-row items-center gap-1", className)} + {...props} + /> + ) +} + +function PaginationItem({ ...props }: React.ComponentProps<"li">) { + return <li data-slot="pagination-item" {...props} /> +} + +type PaginationLinkProps = { + isActive?: boolean +} & Pick<React.ComponentProps<typeof Button>, "size"> & + React.ComponentProps<"a"> + +function PaginationLink({ + className, + isActive, + size = "icon", + ...props +}: PaginationLinkProps) { + return ( + <a + aria-current={isActive ? "page" : undefined} + data-slot="pagination-link" + data-active={isActive} + className={cn( + buttonVariants({ + variant: isActive ? "outline" : "ghost", + size, + }), + className + )} + {...props} + /> + ) +} + +function PaginationPrevious({ + className, + ...props +}: React.ComponentProps<typeof PaginationLink>) { + return ( + <PaginationLink + aria-label="Go to previous page" + size="default" + className={cn("gap-1 px-2.5 sm:pl-2.5", className)} + {...props} + > + <ChevronLeftIcon /> + <span className="hidden sm:block">Previous</span> + </PaginationLink> + ) +} + +function PaginationNext({ + className, + ...props +}: React.ComponentProps<typeof PaginationLink>) { + return ( + <PaginationLink + aria-label="Go to next page" + size="default" + className={cn("gap-1 px-2.5 sm:pr-2.5", className)} + {...props} + > + <span className="hidden sm:block">Next</span> + <ChevronRightIcon /> + </PaginationLink> + ) +} + +function PaginationEllipsis({ + className, + ...props +}: React.ComponentProps<"span">) { + return ( + <span + aria-hidden + data-slot="pagination-ellipsis" + className={cn("flex size-9 items-center justify-center", className)} + {...props} + > + <MoreHorizontalIcon className="size-4" /> + <span className="sr-only">More pages</span> + </span> + ) +} + +export { + Pagination, + PaginationContent, + PaginationLink, + PaginationItem, + PaginationPrevious, + PaginationNext, + PaginationEllipsis, +} diff --git a/src/components/ui/popover.tsx b/src/components/ui/popover.tsx new file mode 100644 index 0000000..01e468b --- /dev/null +++ b/src/components/ui/popover.tsx @@ -0,0 +1,48 @@ +"use client" + +import * as React from "react" +import * as PopoverPrimitive from "@radix-ui/react-popover" + +import { cn } from "@/lib/utils" + +function Popover({ + ...props +}: React.ComponentProps<typeof PopoverPrimitive.Root>) { + return <PopoverPrimitive.Root data-slot="popover" {...props} /> +} + +function PopoverTrigger({ + ...props +}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) { + return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} /> +} + +function PopoverContent({ + className, + align = "center", + sideOffset = 4, + ...props +}: React.ComponentProps<typeof PopoverPrimitive.Content>) { + return ( + <PopoverPrimitive.Portal> + <PopoverPrimitive.Content + data-slot="popover-content" + align={align} + sideOffset={sideOffset} + className={cn( + "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden", + className + )} + {...props} + /> + </PopoverPrimitive.Portal> + ) +} + +function PopoverAnchor({ + ...props +}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) { + return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} /> +} + +export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } diff --git a/src/components/ui/progress.tsx b/src/components/ui/progress.tsx new file mode 100644 index 0000000..10af7e6 --- /dev/null +++ b/src/components/ui/progress.tsx @@ -0,0 +1,29 @@ +import * as React from "react" +import * as ProgressPrimitive from "@radix-ui/react-progress" + +import { cn } from "@/lib/utils" + +function Progress({ + className, + value, + ...props +}: React.ComponentProps<typeof ProgressPrimitive.Root>) { + return ( + <ProgressPrimitive.Root + data-slot="progress" + className={cn( + "bg-primary/20 relative h-2 w-full overflow-hidden rounded-full", + className + )} + {...props} + > + <ProgressPrimitive.Indicator + data-slot="progress-indicator" + className="bg-primary h-full w-full flex-1 transition-all" + style={{ transform: `translateX(-${100 - (value || 0)}%)` }} + /> + </ProgressPrimitive.Root> + ) +} + +export { Progress } diff --git a/src/components/ui/radio-group.tsx b/src/components/ui/radio-group.tsx new file mode 100644 index 0000000..5e6778c --- /dev/null +++ b/src/components/ui/radio-group.tsx @@ -0,0 +1,45 @@ +"use client" + +import * as React from "react" +import * as RadioGroupPrimitive from "@radix-ui/react-radio-group" +import { CircleIcon } from "lucide-react" + +import { cn } from "@/lib/utils" + +function RadioGroup({ + className, + ...props +}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) { + return ( + <RadioGroupPrimitive.Root + data-slot="radio-group" + className={cn("grid gap-3", className)} + {...props} + /> + ) +} + +function RadioGroupItem({ + className, + ...props +}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) { + return ( + <RadioGroupPrimitive.Item + data-slot="radio-group-item" + className={cn( + "border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", + className + )} + {...props} + > + <RadioGroupPrimitive.Indicator + data-slot="radio-group-indicator" + className="relative flex items-center justify-center" + > + <CircleIcon className="fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" /> + </RadioGroupPrimitive.Indicator> + </RadioGroupPrimitive.Item> + ) +} + +export { RadioGroup, RadioGroupItem } diff --git a/src/components/ui/resizable.tsx b/src/components/ui/resizable.tsx new file mode 100644 index 0000000..569328f --- /dev/null +++ b/src/components/ui/resizable.tsx @@ -0,0 +1,54 @@ +import * as React from "react" +import { GripVerticalIcon } from "lucide-react" +import * as ResizablePrimitive from "react-resizable-panels" + +import { cn } from "@/lib/utils" + +function ResizablePanelGroup({ + className, + ...props +}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) { + return ( + <ResizablePrimitive.PanelGroup + data-slot="resizable-panel-group" + className={cn( + "flex h-full w-full data-[panel-group-direction=vertical]:flex-col", + className + )} + {...props} + /> + ) +} + +function ResizablePanel({ + ...props +}: React.ComponentProps<typeof ResizablePrimitive.Panel>) { + return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} /> +} + +function ResizableHandle({ + withHandle, + className, + ...props +}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & { + withHandle?: boolean +}) { + return ( + <ResizablePrimitive.PanelResizeHandle + data-slot="resizable-handle" + className={cn( + "bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90", + className + )} + {...props} + > + {withHandle && ( + <div className="bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border"> + <GripVerticalIcon className="size-2.5" /> + </div> + )} + </ResizablePrimitive.PanelResizeHandle> + ) +} + +export { ResizablePanelGroup, ResizablePanel, ResizableHandle } diff --git a/src/components/ui/scroll-area.tsx b/src/components/ui/scroll-area.tsx new file mode 100644 index 0000000..8e4fa13 --- /dev/null +++ b/src/components/ui/scroll-area.tsx @@ -0,0 +1,58 @@ +"use client" + +import * as React from "react" +import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area" + +import { cn } from "@/lib/utils" + +function ScrollArea({ + className, + children, + ...props +}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) { + return ( + <ScrollAreaPrimitive.Root + data-slot="scroll-area" + className={cn("relative", className)} + {...props} + > + <ScrollAreaPrimitive.Viewport + data-slot="scroll-area-viewport" + className="focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1" + > + {children} + </ScrollAreaPrimitive.Viewport> + <ScrollBar /> + <ScrollAreaPrimitive.Corner /> + </ScrollAreaPrimitive.Root> + ) +} + +function ScrollBar({ + className, + orientation = "vertical", + ...props +}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) { + return ( + <ScrollAreaPrimitive.ScrollAreaScrollbar + data-slot="scroll-area-scrollbar" + orientation={orientation} + className={cn( + "flex touch-none p-px transition-colors select-none", + orientation === "vertical" && + "h-full w-2.5 border-l border-l-transparent", + orientation === "horizontal" && + "h-2.5 flex-col border-t border-t-transparent", + className + )} + {...props} + > + <ScrollAreaPrimitive.ScrollAreaThumb + data-slot="scroll-area-thumb" + className="bg-border relative flex-1 rounded-full" + /> + </ScrollAreaPrimitive.ScrollAreaScrollbar> + ) +} + +export { ScrollArea, ScrollBar } diff --git a/src/components/ui/select.tsx b/src/components/ui/select.tsx new file mode 100644 index 0000000..51f466e --- /dev/null +++ b/src/components/ui/select.tsx @@ -0,0 +1,183 @@ +import * as React from "react" +import * as SelectPrimitive from "@radix-ui/react-select" +import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react" + +import { cn } from "@/lib/utils" + +function Select({ + ...props +}: React.ComponentProps<typeof SelectPrimitive.Root>) { + return <SelectPrimitive.Root data-slot="select" {...props} /> +} + +function SelectGroup({ + ...props +}: React.ComponentProps<typeof SelectPrimitive.Group>) { + return <SelectPrimitive.Group data-slot="select-group" {...props} /> +} + +function SelectValue({ + ...props +}: React.ComponentProps<typeof SelectPrimitive.Value>) { + return <SelectPrimitive.Value data-slot="select-value" {...props} /> +} + +function SelectTrigger({ + className, + size = "default", + children, + ...props +}: React.ComponentProps<typeof SelectPrimitive.Trigger> & { + size?: "sm" | "default" +}) { + return ( + <SelectPrimitive.Trigger + data-slot="select-trigger" + data-size={size} + className={cn( + "border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + className + )} + {...props} + > + {children} + <SelectPrimitive.Icon asChild> + <ChevronDownIcon className="size-4 opacity-50" /> + </SelectPrimitive.Icon> + </SelectPrimitive.Trigger> + ) +} + +function SelectContent({ + className, + children, + position = "popper", + ...props +}: React.ComponentProps<typeof SelectPrimitive.Content>) { + return ( + <SelectPrimitive.Portal> + <SelectPrimitive.Content + data-slot="select-content" + className={cn( + "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md", + position === "popper" && + "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", + className + )} + position={position} + {...props} + > + <SelectScrollUpButton /> + <SelectPrimitive.Viewport + className={cn( + "p-1", + position === "popper" && + "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1" + )} + > + {children} + </SelectPrimitive.Viewport> + <SelectScrollDownButton /> + </SelectPrimitive.Content> + </SelectPrimitive.Portal> + ) +} + +function SelectLabel({ + className, + ...props +}: React.ComponentProps<typeof SelectPrimitive.Label>) { + return ( + <SelectPrimitive.Label + data-slot="select-label" + className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)} + {...props} + /> + ) +} + +function SelectItem({ + className, + children, + ...props +}: React.ComponentProps<typeof SelectPrimitive.Item>) { + return ( + <SelectPrimitive.Item + data-slot="select-item" + className={cn( + "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", + className + )} + {...props} + > + <span className="absolute right-2 flex size-3.5 items-center justify-center"> + <SelectPrimitive.ItemIndicator> + <CheckIcon className="size-4" /> + </SelectPrimitive.ItemIndicator> + </span> + <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText> + </SelectPrimitive.Item> + ) +} + +function SelectSeparator({ + className, + ...props +}: React.ComponentProps<typeof SelectPrimitive.Separator>) { + return ( + <SelectPrimitive.Separator + data-slot="select-separator" + className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)} + {...props} + /> + ) +} + +function SelectScrollUpButton({ + className, + ...props +}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) { + return ( + <SelectPrimitive.ScrollUpButton + data-slot="select-scroll-up-button" + className={cn( + "flex cursor-default items-center justify-center py-1", + className + )} + {...props} + > + <ChevronUpIcon className="size-4" /> + </SelectPrimitive.ScrollUpButton> + ) +} + +function SelectScrollDownButton({ + className, + ...props +}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) { + return ( + <SelectPrimitive.ScrollDownButton + data-slot="select-scroll-down-button" + className={cn( + "flex cursor-default items-center justify-center py-1", + className + )} + {...props} + > + <ChevronDownIcon className="size-4" /> + </SelectPrimitive.ScrollDownButton> + ) +} + +export { + Select, + SelectContent, + SelectGroup, + SelectItem, + SelectLabel, + SelectScrollDownButton, + SelectScrollUpButton, + SelectSeparator, + SelectTrigger, + SelectValue, +} diff --git a/src/components/ui/separator.tsx b/src/components/ui/separator.tsx new file mode 100644 index 0000000..67c73e5 --- /dev/null +++ b/src/components/ui/separator.tsx @@ -0,0 +1,28 @@ +"use client" + +import * as React from "react" +import * as SeparatorPrimitive from "@radix-ui/react-separator" + +import { cn } from "@/lib/utils" + +function Separator({ + className, + orientation = "horizontal", + decorative = true, + ...props +}: React.ComponentProps<typeof SeparatorPrimitive.Root>) { + return ( + <SeparatorPrimitive.Root + data-slot="separator-root" + decorative={decorative} + orientation={orientation} + className={cn( + "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", + className + )} + {...props} + /> + ) +} + +export { Separator } diff --git a/src/components/ui/sheet.tsx b/src/components/ui/sheet.tsx new file mode 100644 index 0000000..6906f5b --- /dev/null +++ b/src/components/ui/sheet.tsx @@ -0,0 +1,137 @@ +import * as React from "react" +import * as SheetPrimitive from "@radix-ui/react-dialog" +import { XIcon } from "lucide-react" + +import { cn } from "@/lib/utils" + +function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) { + return <SheetPrimitive.Root data-slot="sheet" {...props} /> +} + +function SheetTrigger({ + ...props +}: React.ComponentProps<typeof SheetPrimitive.Trigger>) { + return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} /> +} + +function SheetClose({ + ...props +}: React.ComponentProps<typeof SheetPrimitive.Close>) { + return <SheetPrimitive.Close data-slot="sheet-close" {...props} /> +} + +function SheetPortal({ + ...props +}: React.ComponentProps<typeof SheetPrimitive.Portal>) { + return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} /> +} + +function SheetOverlay({ + className, + ...props +}: React.ComponentProps<typeof SheetPrimitive.Overlay>) { + return ( + <SheetPrimitive.Overlay + data-slot="sheet-overlay" + className={cn( + "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", + className + )} + {...props} + /> + ) +} + +function SheetContent({ + className, + children, + side = "right", + ...props +}: React.ComponentProps<typeof SheetPrimitive.Content> & { + side?: "top" | "right" | "bottom" | "left" +}) { + return ( + <SheetPortal> + <SheetOverlay /> + <SheetPrimitive.Content + data-slot="sheet-content" + className={cn( + "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500", + side === "right" && + "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm", + side === "left" && + "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm", + side === "top" && + "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b", + side === "bottom" && + "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t", + className + )} + {...props} + > + {children} + <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none"> + <XIcon className="size-4" /> + <span className="sr-only">Close</span> + </SheetPrimitive.Close> + </SheetPrimitive.Content> + </SheetPortal> + ) +} + +function SheetHeader({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="sheet-header" + className={cn("flex flex-col gap-1.5 p-4", className)} + {...props} + /> + ) +} + +function SheetFooter({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="sheet-footer" + className={cn("mt-auto flex flex-col gap-2 p-4", className)} + {...props} + /> + ) +} + +function SheetTitle({ + className, + ...props +}: React.ComponentProps<typeof SheetPrimitive.Title>) { + return ( + <SheetPrimitive.Title + data-slot="sheet-title" + className={cn("text-foreground font-semibold", className)} + {...props} + /> + ) +} + +function SheetDescription({ + className, + ...props +}: React.ComponentProps<typeof SheetPrimitive.Description>) { + return ( + <SheetPrimitive.Description + data-slot="sheet-description" + className={cn("text-muted-foreground text-sm", className)} + {...props} + /> + ) +} + +export { + Sheet, + SheetTrigger, + SheetClose, + SheetContent, + SheetHeader, + SheetFooter, + SheetTitle, + SheetDescription, +} diff --git a/src/components/ui/sidebar.tsx b/src/components/ui/sidebar.tsx new file mode 100644 index 0000000..65e13c9 --- /dev/null +++ b/src/components/ui/sidebar.tsx @@ -0,0 +1,727 @@ +"use client" + +import * as React from "react" +import { Slot } from "@radix-ui/react-slot" +import { VariantProps, cva } from "class-variance-authority" +import { PanelLeftIcon } from "lucide-react" + +import { useIsMobile } from "@/hooks/use-mobile" +import { cn } from "@/lib/utils" +import { Button } from "@/components/ui/button" +import { Input } from "@/components/ui/input" +import { Separator } from "@/components/ui/separator" +import { + Sheet, + SheetContent, + SheetDescription, + SheetHeader, + SheetTitle, +} from "@/components/ui/sheet" +import { Skeleton } from "@/components/ui/skeleton" +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip" + +const SIDEBAR_COOKIE_NAME = "sidebar_state" +const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7 +const SIDEBAR_WIDTH = "12rem" +const SIDEBAR_WIDTH_MOBILE = "14rem" +const SIDEBAR_WIDTH_ICON = "3rem" +const SIDEBAR_KEYBOARD_SHORTCUT = "b" + + +type SidebarContextProps = { + state: "expanded" | "collapsed" + open: boolean + setOpen: (open: boolean) => void + openMobile: boolean + setOpenMobile: (open: boolean) => void + isMobile: boolean + toggleSidebar: () => void +} + +const SidebarContext = React.createContext<SidebarContextProps | null>(null) + +function useSidebar() { + const context = React.useContext(SidebarContext) + if (!context) { + throw new Error("useSidebar must be used within a SidebarProvider.") + } + + return context +} + +function SidebarProvider({ + defaultOpen = true, + open: openProp, + onOpenChange: setOpenProp, + className, + style, + children, + ...props +}: React.ComponentProps<"div"> & { + defaultOpen?: boolean + open?: boolean + onOpenChange?: (open: boolean) => void +}) { + const isMobile = useIsMobile() + const [openMobile, setOpenMobile] = React.useState(false) + + // This is the internal state of the sidebar. + // We use openProp and setOpenProp for control from outside the component. + const [_open, _setOpen] = React.useState(defaultOpen) + const open = openProp ?? _open + const setOpen = React.useCallback( + (value: boolean | ((value: boolean) => boolean)) => { + const openState = typeof value === "function" ? value(open) : value + if (setOpenProp) { + setOpenProp(openState) + } else { + _setOpen(openState) + } + + // This sets the cookie to keep the sidebar state. + document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}` + }, + [setOpenProp, open] + ) + + // Helper to toggle the sidebar. + const toggleSidebar = React.useCallback(() => { + return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open) + }, [isMobile, setOpen, setOpenMobile]) + + // Adds a keyboard shortcut to toggle the sidebar. + React.useEffect(() => { + const handleKeyDown = (event: KeyboardEvent) => { + if ( + event.key === SIDEBAR_KEYBOARD_SHORTCUT && + (event.metaKey || event.ctrlKey) + ) { + event.preventDefault() + toggleSidebar() + } + } + + window.addEventListener("keydown", handleKeyDown) + return () => window.removeEventListener("keydown", handleKeyDown) + }, [toggleSidebar]) + + // We add a state so that we can do data-state="expanded" or "collapsed". + // This makes it easier to style the sidebar with Tailwind classes. + const state = open ? "expanded" : "collapsed" + + const contextValue = React.useMemo<SidebarContextProps>( + () => ({ + state, + open, + setOpen, + isMobile, + openMobile, + setOpenMobile, + toggleSidebar, + }), + [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar] + ) + + return ( + <SidebarContext.Provider value={contextValue}> + <TooltipProvider delayDuration={0}> + <div + data-slot="sidebar-wrapper" + style={ + { + "--sidebar-width": SIDEBAR_WIDTH, + "--sidebar-width-icon": SIDEBAR_WIDTH_ICON, + ...style, + } as React.CSSProperties + } + className={cn( + "group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", + className + )} + {...props} + > + {children} + </div> + </TooltipProvider> + </SidebarContext.Provider> + ) +} + +function Sidebar({ + side = "left", + variant = "sidebar", + collapsible = "offcanvas", + className, + children, + ...props +}: React.ComponentProps<"div"> & { + side?: "left" | "right" + variant?: "sidebar" | "floating" | "inset" + collapsible?: "offcanvas" | "icon" | "none" +}) { + const { isMobile, state, openMobile, setOpenMobile } = useSidebar() + + if (collapsible === "none") { + return ( + <div + data-slot="sidebar" + className={cn( + "bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", + className + )} + {...props} + > + {children} + </div> + ) + } + + if (isMobile) { + return ( + <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}> + <SheetContent + data-sidebar="sidebar" + data-slot="sidebar" + data-mobile="true" + className="bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden" + style={ + { + "--sidebar-width": SIDEBAR_WIDTH_MOBILE, + } as React.CSSProperties + } + side={side} + > + <SheetHeader className="sr-only"> + <SheetTitle>Sidebar</SheetTitle> + <SheetDescription>Displays the mobile sidebar.</SheetDescription> + </SheetHeader> + <div className="flex h-full w-full flex-col">{children}</div> + </SheetContent> + </Sheet> + ) + } + + return ( + <div + className="group peer text-sidebar-foreground hidden md:block" + data-state={state} + data-collapsible={state === "collapsed" ? collapsible : ""} + data-variant={variant} + data-side={side} + data-slot="sidebar" + > + {/* This is what handles the sidebar gap on desktop */} + <div + data-slot="sidebar-gap" + className={cn( + "relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear", + "group-data-[collapsible=offcanvas]:w-0", + "group-data-[side=right]:rotate-180", + variant === "floating" || variant === "inset" + ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" + : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)" + )} + /> + <div + data-slot="sidebar-container" + className={cn( + "fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex", + side === "left" + ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" + : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]", + // Adjust the padding for floating and inset variants. + variant === "floating" || variant === "inset" + ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" + : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", + className + )} + {...props} + > + <div + data-sidebar="sidebar" + data-slot="sidebar-inner" + className="bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm" + > + {children} + </div> + </div> + </div> + ) +} + +function SidebarTrigger({ + className, + onClick, + ...props +}: React.ComponentProps<typeof Button>) { + const { toggleSidebar } = useSidebar() + + return ( + <Button + data-sidebar="trigger" + data-slot="sidebar-trigger" + variant="ghost" + size="icon" + className={cn("size-7", className)} + onClick={(event) => { + onClick?.(event) + toggleSidebar() + }} + {...props} + > + <PanelLeftIcon /> + <span className="sr-only">Toggle Sidebar</span> + </Button> + ) +} + +function SidebarRail({ className, ...props }: React.ComponentProps<"button">) { + const { toggleSidebar } = useSidebar() + + return ( + <button + data-sidebar="rail" + data-slot="sidebar-rail" + aria-label="Toggle Sidebar" + tabIndex={-1} + onClick={toggleSidebar} + title="Toggle Sidebar" + className={cn( + "hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex", + "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", + "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", + "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full", + "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", + "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", + className + )} + {...props} + /> + ) +} + +function SidebarInset({ className, ...props }: React.ComponentProps<"main">) { + return ( + <main + data-slot="sidebar-inset" + className={cn( + "bg-background relative flex w-full flex-1 flex-col", + "md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2", + className + )} + {...props} + /> + ) +} + +function SidebarInput({ + className, + ...props +}: React.ComponentProps<typeof Input>) { + return ( + <Input + data-slot="sidebar-input" + data-sidebar="input" + className={cn("bg-background h-8 w-full shadow-none", className)} + {...props} + /> + ) +} + +function SidebarHeader({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="sidebar-header" + data-sidebar="header" + className={cn("flex flex-col gap-2 p-2", className)} + {...props} + /> + ) +} + +function SidebarFooter({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="sidebar-footer" + data-sidebar="footer" + className={cn("flex flex-col gap-2 p-2", className)} + {...props} + /> + ) +} + +function SidebarSeparator({ + className, + ...props +}: React.ComponentProps<typeof Separator>) { + return ( + <Separator + data-slot="sidebar-separator" + data-sidebar="separator" + className={cn("bg-sidebar-border mx-2 w-auto", className)} + {...props} + /> + ) +} + +function SidebarContent({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="sidebar-content" + data-sidebar="content" + className={cn( + "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", + className + )} + {...props} + /> + ) +} + +function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="sidebar-group" + data-sidebar="group" + className={cn("relative flex w-full min-w-0 flex-col p-2", className)} + {...props} + /> + ) +} + +function SidebarGroupLabel({ + className, + asChild = false, + ...props +}: React.ComponentProps<"div"> & { asChild?: boolean }) { + const Comp = asChild ? Slot : "div" + + return ( + <Comp + data-slot="sidebar-group-label" + data-sidebar="group-label" + className={cn( + "text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", + "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", + className + )} + {...props} + /> + ) +} + +function SidebarGroupAction({ + className, + asChild = false, + ...props +}: React.ComponentProps<"button"> & { asChild?: boolean }) { + const Comp = asChild ? Slot : "button" + + return ( + <Comp + data-slot="sidebar-group-action" + data-sidebar="group-action" + className={cn( + "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", + // Increases the hit area of the button on mobile. + "after:absolute after:-inset-2 md:after:hidden", + "group-data-[collapsible=icon]:hidden", + className + )} + {...props} + /> + ) +} + +function SidebarGroupContent({ + className, + ...props +}: React.ComponentProps<"div">) { + return ( + <div + data-slot="sidebar-group-content" + data-sidebar="group-content" + className={cn("w-full text-sm", className)} + {...props} + /> + ) +} + +function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) { + return ( + <ul + data-slot="sidebar-menu" + data-sidebar="menu" + className={cn("flex w-full min-w-0 flex-col gap-1", className)} + {...props} + /> + ) +} + +function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) { + return ( + <li + data-slot="sidebar-menu-item" + data-sidebar="menu-item" + className={cn("group/menu-item relative", className)} + {...props} + /> + ) +} + +const sidebarMenuButtonVariants = cva( + "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", + { + variants: { + variant: { + default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", + outline: + "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]", + }, + size: { + default: "h-8 text-sm", + sm: "h-7 text-xs", + lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!", + }, + }, + defaultVariants: { + variant: "default", + size: "default", + }, + } +) + +function SidebarMenuButton({ + asChild = false, + isActive = false, + variant = "default", + size = "default", + tooltip, + className, + ...props +}: React.ComponentProps<"button"> & { + asChild?: boolean + isActive?: boolean + tooltip?: string | React.ComponentProps<typeof TooltipContent> +} & VariantProps<typeof sidebarMenuButtonVariants>) { + const Comp = asChild ? Slot : "button" + const { isMobile, state } = useSidebar() + + const button = ( + <Comp + data-slot="sidebar-menu-button" + data-sidebar="menu-button" + data-size={size} + data-active={isActive} + className={cn(sidebarMenuButtonVariants({ variant, size }), className)} + {...props} + /> + ) + + if (!tooltip) { + return button + } + + if (typeof tooltip === "string") { + tooltip = { + children: tooltip, + } + } + + return ( + <Tooltip> + <TooltipTrigger asChild>{button}</TooltipTrigger> + <TooltipContent + side="right" + align="center" + hidden={state !== "collapsed" || isMobile} + {...tooltip} + /> + </Tooltip> + ) +} + +function SidebarMenuAction({ + className, + asChild = false, + showOnHover = false, + ...props +}: React.ComponentProps<"button"> & { + asChild?: boolean + showOnHover?: boolean +}) { + const Comp = asChild ? Slot : "button" + + return ( + <Comp + data-slot="sidebar-menu-action" + data-sidebar="menu-action" + className={cn( + "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", + // Increases the hit area of the button on mobile. + "after:absolute after:-inset-2 md:after:hidden", + "peer-data-[size=sm]/menu-button:top-1", + "peer-data-[size=default]/menu-button:top-1.5", + "peer-data-[size=lg]/menu-button:top-2.5", + "group-data-[collapsible=icon]:hidden", + showOnHover && + "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0", + className + )} + {...props} + /> + ) +} + +function SidebarMenuBadge({ + className, + ...props +}: React.ComponentProps<"div">) { + return ( + <div + data-slot="sidebar-menu-badge" + data-sidebar="menu-badge" + className={cn( + "text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none", + "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", + "peer-data-[size=sm]/menu-button:top-1", + "peer-data-[size=default]/menu-button:top-1.5", + "peer-data-[size=lg]/menu-button:top-2.5", + "group-data-[collapsible=icon]:hidden", + className + )} + {...props} + /> + ) +} + +function SidebarMenuSkeleton({ + className, + showIcon = false, + ...props +}: React.ComponentProps<"div"> & { + showIcon?: boolean +}) { + // Random width between 50 to 90%. + const width = React.useMemo(() => { + return `${Math.floor(Math.random() * 40) + 50}%` + }, []) + + return ( + <div + data-slot="sidebar-menu-skeleton" + data-sidebar="menu-skeleton" + className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)} + {...props} + > + {showIcon && ( + <Skeleton + className="size-4 rounded-md" + data-sidebar="menu-skeleton-icon" + /> + )} + <Skeleton + className="h-4 max-w-(--skeleton-width) flex-1" + data-sidebar="menu-skeleton-text" + style={ + { + "--skeleton-width": width, + } as React.CSSProperties + } + /> + </div> + ) +} + +function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) { + return ( + <ul + data-slot="sidebar-menu-sub" + data-sidebar="menu-sub" + className={cn( + "border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5", + "group-data-[collapsible=icon]:hidden", + className + )} + {...props} + /> + ) +} + +function SidebarMenuSubItem({ + className, + ...props +}: React.ComponentProps<"li">) { + return ( + <li + data-slot="sidebar-menu-sub-item" + data-sidebar="menu-sub-item" + className={cn("group/menu-sub-item relative", className)} + {...props} + /> + ) +} + +function SidebarMenuSubButton({ + asChild = false, + size = "md", + isActive = false, + className, + ...props +}: React.ComponentProps<"a"> & { + asChild?: boolean + size?: "sm" | "md" + isActive?: boolean +}) { + const Comp = asChild ? Slot : "a" + + return ( + <Comp + data-slot="sidebar-menu-sub-button" + data-sidebar="menu-sub-button" + data-size={size} + data-active={isActive} + className={cn( + "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", + "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", + size === "sm" && "text-xs", + size === "md" && "text-sm", + "group-data-[collapsible=icon]:hidden", + className + )} + {...props} + /> + ) +} + +export { + Sidebar, + SidebarContent, + SidebarFooter, + SidebarGroup, + SidebarGroupAction, + SidebarGroupContent, + SidebarGroupLabel, + SidebarHeader, + SidebarInput, + SidebarInset, + SidebarMenu, + SidebarMenuAction, + SidebarMenuBadge, + SidebarMenuButton, + SidebarMenuItem, + SidebarMenuSkeleton, + SidebarMenuSub, + SidebarMenuSubButton, + SidebarMenuSubItem, + SidebarProvider, + SidebarRail, + SidebarSeparator, + SidebarTrigger, + useSidebar, +} diff --git a/src/components/ui/skeleton.tsx b/src/components/ui/skeleton.tsx new file mode 100644 index 0000000..32ea0ef --- /dev/null +++ b/src/components/ui/skeleton.tsx @@ -0,0 +1,13 @@ +import { cn } from "@/lib/utils" + +function Skeleton({ className, ...props }: React.ComponentProps<"div">) { + return ( + <div + data-slot="skeleton" + className={cn("bg-accent animate-pulse rounded-md", className)} + {...props} + /> + ) +} + +export { Skeleton } diff --git a/src/components/ui/slider.tsx b/src/components/ui/slider.tsx new file mode 100644 index 0000000..09391e8 --- /dev/null +++ b/src/components/ui/slider.tsx @@ -0,0 +1,63 @@ +"use client" + +import * as React from "react" +import * as SliderPrimitive from "@radix-ui/react-slider" + +import { cn } from "@/lib/utils" + +function Slider({ + className, + defaultValue, + value, + min = 0, + max = 100, + ...props +}: React.ComponentProps<typeof SliderPrimitive.Root>) { + const _values = React.useMemo( + () => + Array.isArray(value) + ? value + : Array.isArray(defaultValue) + ? defaultValue + : [min, max], + [value, defaultValue, min, max] + ) + + return ( + <SliderPrimitive.Root + data-slot="slider" + defaultValue={defaultValue} + value={value} + min={min} + max={max} + className={cn( + "relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col", + className + )} + {...props} + > + <SliderPrimitive.Track + data-slot="slider-track" + className={cn( + "bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5" + )} + > + <SliderPrimitive.Range + data-slot="slider-range" + className={cn( + "bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full" + )} + /> + </SliderPrimitive.Track> + {Array.from({ length: _values.length }, (_, index) => ( + <SliderPrimitive.Thumb + data-slot="slider-thumb" + key={index} + className="border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50" + /> + ))} + </SliderPrimitive.Root> + ) +} + +export { Slider } diff --git a/src/components/ui/sonner.tsx b/src/components/ui/sonner.tsx new file mode 100644 index 0000000..cd62aff --- /dev/null +++ b/src/components/ui/sonner.tsx @@ -0,0 +1,23 @@ +import { useTheme } from "next-themes" +import { Toaster as Sonner, ToasterProps } from "sonner" + +const Toaster = ({ ...props }: ToasterProps) => { + const { theme = "system" } = useTheme() + + return ( + <Sonner + theme={theme as ToasterProps["theme"]} + className="toaster group" + style={ + { + "--normal-bg": "var(--popover)", + "--normal-text": "var(--popover-foreground)", + "--normal-border": "var(--border)", + } as React.CSSProperties + } + {...props} + /> + ) +} + +export { Toaster } diff --git a/src/components/ui/switch.tsx b/src/components/ui/switch.tsx new file mode 100644 index 0000000..6a2b524 --- /dev/null +++ b/src/components/ui/switch.tsx @@ -0,0 +1,31 @@ +"use client" + +import * as React from "react" +import * as SwitchPrimitive from "@radix-ui/react-switch" + +import { cn } from "@/lib/utils" + +function Switch({ + className, + ...props +}: React.ComponentProps<typeof SwitchPrimitive.Root>) { + return ( + <SwitchPrimitive.Root + data-slot="switch" + className={cn( + "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", + className + )} + {...props} + > + <SwitchPrimitive.Thumb + data-slot="switch-thumb" + className={cn( + "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0" + )} + /> + </SwitchPrimitive.Root> + ) +} + +export { Switch } diff --git a/src/components/ui/table.tsx b/src/components/ui/table.tsx new file mode 100644 index 0000000..5513a5c --- /dev/null +++ b/src/components/ui/table.tsx @@ -0,0 +1,114 @@ +import * as React from "react" + +import { cn } from "@/lib/utils" + +function Table({ className, ...props }: React.ComponentProps<"table">) { + return ( + <div + data-slot="table-container" + className="relative w-full overflow-x-auto" + > + <table + data-slot="table" + className={cn("w-full caption-bottom text-sm", className)} + {...props} + /> + </div> + ) +} + +function TableHeader({ className, ...props }: React.ComponentProps<"thead">) { + return ( + <thead + data-slot="table-header" + className={cn("[&_tr]:border-b", className)} + {...props} + /> + ) +} + +function TableBody({ className, ...props }: React.ComponentProps<"tbody">) { + return ( + <tbody + data-slot="table-body" + className={cn("[&_tr:last-child]:border-0", className)} + {...props} + /> + ) +} + +function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) { + return ( + <tfoot + data-slot="table-footer" + className={cn( + "bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", + className + )} + {...props} + /> + ) +} + +function TableRow({ className, ...props }: React.ComponentProps<"tr">) { + return ( + <tr + data-slot="table-row" + className={cn( + "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors", + className + )} + {...props} + /> + ) +} + +function TableHead({ className, ...props }: React.ComponentProps<"th">) { + return ( + <th + data-slot="table-head" + className={cn( + "text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", + className + )} + {...props} + /> + ) +} + +function TableCell({ className, ...props }: React.ComponentProps<"td">) { + return ( + <td + data-slot="table-cell" + className={cn( + "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", + className + )} + {...props} + /> + ) +} + +function TableCaption({ + className, + ...props +}: React.ComponentProps<"caption">) { + return ( + <caption + data-slot="table-caption" + className={cn("text-muted-foreground mt-4 text-sm", className)} + {...props} + /> + ) +} + +export { + Table, + TableHeader, + TableBody, + TableFooter, + TableHead, + TableRow, + TableCell, + TableCaption, +} diff --git a/src/components/ui/tabs.tsx b/src/components/ui/tabs.tsx new file mode 100644 index 0000000..497ba5e --- /dev/null +++ b/src/components/ui/tabs.tsx @@ -0,0 +1,66 @@ +"use client" + +import * as React from "react" +import * as TabsPrimitive from "@radix-ui/react-tabs" + +import { cn } from "@/lib/utils" + +function Tabs({ + className, + ...props +}: React.ComponentProps<typeof TabsPrimitive.Root>) { + return ( + <TabsPrimitive.Root + data-slot="tabs" + className={cn("flex flex-col gap-2", className)} + {...props} + /> + ) +} + +function TabsList({ + className, + ...props +}: React.ComponentProps<typeof TabsPrimitive.List>) { + return ( + <TabsPrimitive.List + data-slot="tabs-list" + className={cn( + "bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]", + className + )} + {...props} + /> + ) +} + +function TabsTrigger({ + className, + ...props +}: React.ComponentProps<typeof TabsPrimitive.Trigger>) { + return ( + <TabsPrimitive.Trigger + data-slot="tabs-trigger" + className={cn( + "data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + className + )} + {...props} + /> + ) +} + +function TabsContent({ + className, + ...props +}: React.ComponentProps<typeof TabsPrimitive.Content>) { + return ( + <TabsPrimitive.Content + data-slot="tabs-content" + className={cn("flex-1 outline-none", className)} + {...props} + /> + ) +} + +export { Tabs, TabsList, TabsTrigger, TabsContent } diff --git a/src/components/ui/textarea.tsx b/src/components/ui/textarea.tsx new file mode 100644 index 0000000..7f21b5e --- /dev/null +++ b/src/components/ui/textarea.tsx @@ -0,0 +1,18 @@ +import * as React from "react" + +import { cn } from "@/lib/utils" + +function Textarea({ className, ...props }: React.ComponentProps<"textarea">) { + return ( + <textarea + data-slot="textarea" + className={cn( + "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", + className + )} + {...props} + /> + ) +} + +export { Textarea } diff --git a/src/components/ui/toggle-group.tsx b/src/components/ui/toggle-group.tsx new file mode 100644 index 0000000..5eed401 --- /dev/null +++ b/src/components/ui/toggle-group.tsx @@ -0,0 +1,73 @@ +"use client" + +import * as React from "react" +import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group" +import { type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" +import { toggleVariants } from "@/components/ui/toggle" + +const ToggleGroupContext = React.createContext< + VariantProps<typeof toggleVariants> +>({ + size: "default", + variant: "default", +}) + +function ToggleGroup({ + className, + variant, + size, + children, + ...props +}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> & + VariantProps<typeof toggleVariants>) { + return ( + <ToggleGroupPrimitive.Root + data-slot="toggle-group" + data-variant={variant} + data-size={size} + className={cn( + "group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs", + className + )} + {...props} + > + <ToggleGroupContext.Provider value={{ variant, size }}> + {children} + </ToggleGroupContext.Provider> + </ToggleGroupPrimitive.Root> + ) +} + +function ToggleGroupItem({ + className, + children, + variant, + size, + ...props +}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> & + VariantProps<typeof toggleVariants>) { + const context = React.useContext(ToggleGroupContext) + + return ( + <ToggleGroupPrimitive.Item + data-slot="toggle-group-item" + data-variant={context.variant || variant} + data-size={context.size || size} + className={cn( + toggleVariants({ + variant: context.variant || variant, + size: context.size || size, + }), + "min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l", + className + )} + {...props} + > + {children} + </ToggleGroupPrimitive.Item> + ) +} + +export { ToggleGroup, ToggleGroupItem } diff --git a/src/components/ui/toggle.tsx b/src/components/ui/toggle.tsx new file mode 100644 index 0000000..b966221 --- /dev/null +++ b/src/components/ui/toggle.tsx @@ -0,0 +1,45 @@ +import * as React from "react" +import * as TogglePrimitive from "@radix-ui/react-toggle" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" + +const toggleVariants = cva( + "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap", + { + variants: { + variant: { + default: "bg-transparent", + outline: + "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground", + }, + size: { + default: "h-9 px-2 min-w-9", + sm: "h-8 px-1.5 min-w-8", + lg: "h-10 px-2.5 min-w-10", + }, + }, + defaultVariants: { + variant: "default", + size: "default", + }, + } +) + +function Toggle({ + className, + variant, + size, + ...props +}: React.ComponentProps<typeof TogglePrimitive.Root> & + VariantProps<typeof toggleVariants>) { + return ( + <TogglePrimitive.Root + data-slot="toggle" + className={cn(toggleVariants({ variant, size, className }))} + {...props} + /> + ) +} + +export { Toggle, toggleVariants } diff --git a/src/components/ui/tooltip.tsx b/src/components/ui/tooltip.tsx new file mode 100644 index 0000000..71ee0fe --- /dev/null +++ b/src/components/ui/tooltip.tsx @@ -0,0 +1,59 @@ +import * as React from "react" +import * as TooltipPrimitive from "@radix-ui/react-tooltip" + +import { cn } from "@/lib/utils" + +function TooltipProvider({ + delayDuration = 0, + ...props +}: React.ComponentProps<typeof TooltipPrimitive.Provider>) { + return ( + <TooltipPrimitive.Provider + data-slot="tooltip-provider" + delayDuration={delayDuration} + {...props} + /> + ) +} + +function Tooltip({ + ...props +}: React.ComponentProps<typeof TooltipPrimitive.Root>) { + return ( + <TooltipProvider> + <TooltipPrimitive.Root data-slot="tooltip" {...props} /> + </TooltipProvider> + ) +} + +function TooltipTrigger({ + ...props +}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) { + return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} /> +} + +function TooltipContent({ + className, + sideOffset = 0, + children, + ...props +}: React.ComponentProps<typeof TooltipPrimitive.Content>) { + return ( + <TooltipPrimitive.Portal> + <TooltipPrimitive.Content + data-slot="tooltip-content" + sideOffset={sideOffset} + className={cn( + "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance", + className + )} + {...props} + > + {children} + <TooltipPrimitive.Arrow className="bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" /> + </TooltipPrimitive.Content> + </TooltipPrimitive.Portal> + ) +} + +export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } diff --git a/src/counterSlice.ts b/src/counterSlice.ts new file mode 100644 index 0000000..1482de1 --- /dev/null +++ b/src/counterSlice.ts @@ -0,0 +1,44 @@ +import { createAsyncThunk, createSlice } from '@reduxjs/toolkit' +import type { PayloadAction } from '@reduxjs/toolkit' + +// Define the TS type for the counter slice's state +export interface CounterState { + value: number + status: 'idle' | 'loading' | 'failed' +} + +// Define the initial value for the slice state +const initialState: CounterState = { + value: 0, + status: 'idle' +} + +// Slices contain Redux reducer logic for updating state, and +// generate actions that can be dispatched to trigger those updates. +export const counterSlice = createSlice({ + name: 'counter', + initialState, + // The `reducers` field lets us define reducers and generate associated actions + reducers: { + increment: state => { + // Redux Toolkit allows us to write "mutating" logic in reducers. It + // doesn't actually mutate the state because it uses the Immer library, + // which detects changes to a "draft state" and produces a brand new + // immutable state based off those changes + state.value += 1 + }, + decrement: state => { + state.value -= 1 + }, + // Use the PayloadAction type to declare the contents of `action.payload` + incrementByAmount: (state, action: PayloadAction<number>) => { + state.value += action.payload + } + } +}) + +// Export the generated action creators for use in components +export const { increment, decrement, incrementByAmount } = counterSlice.actions + +// Export the slice reducer for use in the store configuration +export default counterSlice.reducer
\ No newline at end of file diff --git a/src/hooks.ts b/src/hooks.ts new file mode 100644 index 0000000..2e13fb8 --- /dev/null +++ b/src/hooks.ts @@ -0,0 +1,7 @@ +// This file serves as a central hub for re-exporting pre-typed Redux hooks. +import { useDispatch, useSelector } from 'react-redux' +import type { AppDispatch, RootState } from '@/store.ts' + +// Use throughout your app instead of plain `useDispatch` and `useSelector` +export const useAppDispatch = useDispatch.withTypes<AppDispatch>() +export const useAppSelector = useSelector.withTypes<RootState>()
\ No newline at end of file diff --git a/src/hooks/use-mobile.ts b/src/hooks/use-mobile.ts new file mode 100644 index 0000000..2b0fe1d --- /dev/null +++ b/src/hooks/use-mobile.ts @@ -0,0 +1,19 @@ +import * as React from "react" + +const MOBILE_BREAKPOINT = 768 + +export function useIsMobile() { + const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined) + + React.useEffect(() => { + const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`) + const onChange = () => { + setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) + } + mql.addEventListener("change", onChange) + setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) + return () => mql.removeEventListener("change", onChange) + }, []) + + return !!isMobile +} diff --git a/src/index.css b/src/index.css new file mode 100644 index 0000000..9e80986 --- /dev/null +++ b/src/index.css @@ -0,0 +1,145 @@ +@import "tailwindcss"; +@import "tw-animate-css"; + +#testD4rN { + max-width: 800px; + max-height: 400px !important; +} + +@custom-variant dark (&:is(.dark *)); + +@theme inline { + --radius-sm: calc(var(--radius) - 4px); + --radius-md: calc(var(--radius) - 2px); + --radius-lg: var(--radius); + --radius-xl: calc(var(--radius) + 4px); + --color-background: var(--background); + --color-foreground: var(--foreground); + --color-card: var(--card); + --color-card-foreground: var(--card-foreground); + --color-popover: var(--popover); + --color-popover-foreground: var(--popover-foreground); + --color-primary: var(--primary); + --color-primary-foreground: var(--primary-foreground); + --color-secondary: var(--secondary); + --color-secondary-foreground: var(--secondary-foreground); + --color-muted: var(--muted); + --color-muted-foreground: var(--muted-foreground); + --color-accent: var(--accent); + --color-accent-foreground: var(--accent-foreground); + --color-destructive: var(--destructive); + --color-border: var(--border); + --color-input: var(--input); + --color-ring: var(--ring); + --color-chart-1: var(--chart-1); + --color-chart-2: var(--chart-2); + --color-chart-3: var(--chart-3); + --color-chart-4: var(--chart-4); + --color-chart-5: var(--chart-5); + --color-sidebar: var(--sidebar); + --color-sidebar-foreground: var(--sidebar-foreground); + --color-sidebar-primary: var(--sidebar-primary); + --color-sidebar-primary-foreground: var(--sidebar-primary-foreground); + --color-sidebar-accent: var(--sidebar-accent); + --color-sidebar-accent-foreground: var(--sidebar-accent-foreground); + --color-sidebar-border: var(--sidebar-border); + --color-sidebar-ring: var(--sidebar-ring); + --animate-accordion-down: accordion-down 0.2s ease-out; + --animate-accordion-up: accordion-up 0.2s ease-out; + + @keyframes accordion-down { + from { + height: 0; + } + to { + height: var(--radix-accordion-content-height); + } + } + + @keyframes accordion-up { + from { + height: var(--radix-accordion-content-height); + } + to { + height: 0; + } + } +} + +:root { + --radius: 0.625rem; + --background: oklch(1 0 0); + --foreground: oklch(0.145 0 0); + --card: oklch(1 0 0); + --card-foreground: oklch(0.145 0 0); + --popover: oklch(1 0 0); + --popover-foreground: oklch(0.145 0 0); + --primary: oklch(0.205 0 0); + --primary-foreground: oklch(0.985 0 0); + --secondary: oklch(0.97 0 0); + --secondary-foreground: oklch(0.205 0 0); + --muted: oklch(0.97 0 0); + --muted-foreground: oklch(0.556 0 0); + --accent: oklch(0.97 0 0); + --accent-foreground: oklch(0.205 0 0); + --destructive: oklch(0.577 0.245 27.325); + --border: oklch(0.922 0 0); + --input: oklch(0.922 0 0); + --ring: oklch(0.708 0 0); + --chart-1: oklch(0.646 0.222 41.116); + --chart-2: oklch(0.6 0.118 184.704); + --chart-3: oklch(0.398 0.07 227.392); + --chart-4: oklch(0.828 0.189 84.429); + --chart-5: oklch(0.769 0.188 70.08); + --sidebar: oklch(0.985 0 0); + --sidebar-foreground: oklch(0.145 0 0); + --sidebar-primary: oklch(0.205 0 0); + --sidebar-primary-foreground: oklch(0.985 0 0); + --sidebar-accent: oklch(0.97 0 0); + --sidebar-accent-foreground: oklch(0.205 0 0); + --sidebar-border: oklch(0.922 0 0); + --sidebar-ring: oklch(0.708 0 0); +} + +.dark { + --background: oklch(0.145 0 0); + --foreground: oklch(0.985 0 0); + --card: oklch(0.205 0 0); + --card-foreground: oklch(0.985 0 0); + --popover: oklch(0.205 0 0); + --popover-foreground: oklch(0.985 0 0); + --primary: oklch(0.922 0 0); + --primary-foreground: oklch(0.205 0 0); + --secondary: oklch(0.269 0 0); + --secondary-foreground: oklch(0.985 0 0); + --muted: oklch(0.269 0 0); + --muted-foreground: oklch(0.708 0 0); + --accent: oklch(0.269 0 0); + --accent-foreground: oklch(0.985 0 0); + --destructive: oklch(0.704 0.191 22.216); + --border: oklch(1 0 0 / 10%); + --input: oklch(1 0 0 / 15%); + --ring: oklch(0.556 0 0); + --chart-1: oklch(0.488 0.243 264.376); + --chart-2: oklch(0.696 0.17 162.48); + --chart-3: oklch(0.769 0.188 70.08); + --chart-4: oklch(0.627 0.265 303.9); + --chart-5: oklch(0.645 0.246 16.439); + --sidebar: oklch(0.205 0 0); + --sidebar-foreground: oklch(0.985 0 0); + --sidebar-primary: oklch(0.488 0.243 264.376); + --sidebar-primary-foreground: oklch(0.985 0 0); + --sidebar-accent: oklch(0.269 0 0); + --sidebar-accent-foreground: oklch(0.985 0 0); + --sidebar-border: oklch(1 0 0 / 10%); + --sidebar-ring: oklch(0.556 0 0); +} + +@layer base { + * { + @apply border-border outline-ring/50; + } + body { + @apply bg-background text-foreground; + } +}
\ No newline at end of file diff --git a/src/lib/utils.ts b/src/lib/utils.ts new file mode 100644 index 0000000..bd0c391 --- /dev/null +++ b/src/lib/utils.ts @@ -0,0 +1,6 @@ +import { clsx, type ClassValue } from "clsx" +import { twMerge } from "tailwind-merge" + +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)) +} diff --git a/src/main.tsx b/src/main.tsx new file mode 100644 index 0000000..a6cc146 --- /dev/null +++ b/src/main.tsx @@ -0,0 +1,52 @@ +import {createRoot} from 'react-dom/client' +import {Widget} from './Widget' +import {App} from "@/models/app.ts" +import {Provider} from 'react-redux' +import React from 'react' + +import {store} from './store' +import {setApp} from "@/models/appSlice.ts"; + +(function () { + + // Finding the script tag on the page.. + const scriptTags = document.querySelectorAll('script[data-bpuid]'); + let currentScript: HTMLScriptElement | null = null; + for (const tag of scriptTags) { + currentScript = tag as HTMLScriptElement; + } + + // GRL Snippet configuration options + const settings: App = { + targetId: currentScript?.getAttribute("data-target") || 'grl-widget', + bpid: currentScript?.getAttribute("data-bpid") || "invalid-bpid-from-snippet", + bpuid: currentScript?.getAttribute("data-bpuid") || "invalid-bpuid-from-snippet", + offerwall: currentScript?.getAttribute("data-offerwall") || "37d1da64", + walletMode: Boolean(currentScript?.getAttribute("data-wallet")) || true, + panelName: currentScript?.getAttribute("data-panel") || null, + leaderboard: Boolean(currentScript?.getAttribute("data-leaderboard")) || false, + + currentPage: "offerwall" + } + store.dispatch(setApp(settings)) + + // Avoid adding the widget multiple times + const container: HTMLElement | null = document.getElementById(settings.targetId) + if (container) { + // ensure that it's empty? + } else { + let container = document.createElement('div') + container.id = settings.targetId + document.body.appendChild(container) + } + + const root = createRoot(container) + root.render( + <React.StrictMode> + <Provider store={store}> + <Widget/> + </Provider> + </React.StrictMode> + ); + +})()
\ No newline at end of file diff --git a/src/models/CashoutMethod.ts b/src/models/CashoutMethod.ts new file mode 100644 index 0000000..8da88ac --- /dev/null +++ b/src/models/CashoutMethod.ts @@ -0,0 +1,33 @@ +import {CashoutMethodOut} from "@/api/models/cashout-method-out.ts" + +export class CashoutMethod implements CashoutMethodOut { + id: string; // uuid + currency: string; // 3-letter all caps + originalCurrency: string; // 3-letter all caps + data: any; + description: string; // html description + imageUrl: string; // cloudfront cdn + maxValue: number; // pixels int + minValue: number; // pixels int + name: string; + type: string; // TANGO + extId: string; // U179271 + productId?: any; + productUserId?: any; + + constructor(data) { + this.originalCurrency = data.original_currency; + this.currency = data.currency; + this.data = data.data; + this.description = data.description; + this.extId = data.ext_id; + this.id = data.id; + this.imageUrl = data.image_url; + this.maxValue = data.max_value; + this.minValue = data.min_value; + this.name = data.name; + this.type = data.type; + + } + +}
\ No newline at end of file diff --git a/src/models/app.ts b/src/models/app.ts new file mode 100644 index 0000000..a0412e0 --- /dev/null +++ b/src/models/app.ts @@ -0,0 +1,13 @@ +export type Page = 'offerwall' | 'questions' | 'cashouts'; + +export interface App { + targetId: string, + bpid: string; + bpuid: string; + offerwall: string; + walletMode: boolean; + panelName: string | null; + leaderboard: boolean; + + currentPage: Page +} diff --git a/src/models/appSlice.ts b/src/models/appSlice.ts new file mode 100644 index 0000000..d7e4a0b --- /dev/null +++ b/src/models/appSlice.ts @@ -0,0 +1,23 @@ +import {createSlice, PayloadAction} from '@reduxjs/toolkit' +import {App, Page} from "@/models/app.ts" + + +const initialState = {} + +const appSlice = createSlice({ + name: 'app', + initialState, + reducers: { + setApp(state, action: PayloadAction<App>) { + console.log("setApp", action.payload) + return action.payload; + }, + setPage(state, action: PayloadAction<Page>) { + console.log("setPage.state", state.currentPage, action.payload) + state.currentPage = action.payload; + } + } +}) + +export const {setApp, setPage} = appSlice.actions; +export default appSlice.reducer
\ No newline at end of file diff --git a/src/models/bucket.ts b/src/models/bucket.ts new file mode 100644 index 0000000..a9419a6 --- /dev/null +++ b/src/models/bucket.ts @@ -0,0 +1,32 @@ +import {SoftPairBucket} from "@/api/models/soft-pair-bucket.ts" + +export class SoftPairBucketClass implements SoftPairBucket { + readonly id: string; + readonly uri: string; + readonly category: any | null; + readonly contents: any; + readonly eligibility: any; + readonly missingQuestions: any | null; + readonly loi: any; + readonly payout: any; + + constructor(data: { + id: string, + uri: string, + category: any | null, + contents: any, + eligibility: any, + missingQuestions: any | null, + loi: any, + payout: any + }) { + this.id = data.id; + this.uri = data.uri; + this.category = data.category; + this.contents = data.contents; + this.eligibility = data.eligibility; + this.missingQuestions = data.missingQuestions; + this.loi = data.loi; + this.payout = data.payout; + } +}
\ No newline at end of file diff --git a/src/models/bucketSlice.ts b/src/models/bucketSlice.ts new file mode 100644 index 0000000..9c6aee8 --- /dev/null +++ b/src/models/bucketSlice.ts @@ -0,0 +1,34 @@ +import {createSlice, PayloadAction} from '@reduxjs/toolkit' +import {SoftPairBucketClass} from "@/models/bucket.ts" +// import {ProfilingQuestion} from "@/models/question.ts"; +import type {RootState} from '@/store' +import {SoftPairBucket} from "@/api/models/soft-pair-bucket.ts" + +// Create an initial state value for the reducer, with that type +const initialState: SoftPairBucket[] = [] + +// Create the slice and pass in the initial state +const bucketSlice = createSlice({ + name: 'buckets', + initialState, + reducers: { + setBuckets(state, action: PayloadAction<SoftPairBucket[]>) { + return action.payload; + }, + bucketAdded(state, action: PayloadAction<SoftPairBucket>) { + state.push(action.payload); + } + } +}) + +// Export the generated reducer function +export const {setBuckets, bucketAdded} = bucketSlice.actions; +export default bucketSlice.reducer + +export const selectBucketsStatus = (state: RootState) => state.buckets.status +export const selectBucketsError = (state: RootState) => state.buckets.error + +export const selectAllBuckets = (state: RootState) => state.buckets + +export const selectBucketById = (state: RootState, bucketId: string | null) => + state.buckets.find(bucket => bucket.id === bucketId)
\ No newline at end of file diff --git a/src/models/question.ts b/src/models/question.ts new file mode 100644 index 0000000..996589b --- /dev/null +++ b/src/models/question.ts @@ -0,0 +1,272 @@ +import {stringify} from "querystring"; +import {ChoiceType, ConfigurationType, PatternType, QuestionType, SelectorType, ValidationType} from "@/types.ts" +import {UpkQuestion} from "@/api/models/upk-question.ts" +import {UpkQuestionType} from "@/api"; + + +export class ProfilingAnswer { + // let values: Array<{ value: string }> = question_answer.values || [] + + questionId: string; + values: string[] = []; + + constructor(qid: string, values: string[]) { + this.questionId = qid; + this.values = values + } +} + +export class ProfilingQuestion implements UpkQuestion { + questionId: string; // It's a UUID + countryIso: string; // 2-letter lower + languageIso: string; // 3-letter lower + + questionType: UpkQuestionType; + selector: SelectorType; + questionText: string; // "title" of the question + + choices?: ChoiceType[]; + + extQuestionId?: any; + configuration: ConfigurationType | null = null; + validation: ValidationType | null = null; + + importance?: any; + task_count: number; + task_score: number; + + private _complete: boolean = false; + private _processing: boolean = false; + private _answer: ProfilingAnswer | null = null; + + error_msg: string = ""; + + constructor(data) { + this.questionId = data.question_id; + this.countryIso = data.country_iso; + this.languageIso = data.language_iso; + + this.questionType = data.question_type; + this.selector = data.selector; + this.questionText = data.question_text; + + this.choices = data.choices + + this.extQuestionId = data.ext_question_id; + this.configuration = data.configuration; + this.validation = data.validation; + } + + // --- Properties --- + + getType(): QuestionType { + return this.questionType as QuestionType + } + + getSelector(): SelectorType { + return this.selector as SelectorType + } + + getChoices(): ChoiceType[] | null { + const choices: ChoiceType[] = this.choices; + if (choices.length > 0) { + return choices; + } else { + return null; + } + } + + // --- Methods --- + + addAnswer(val: string): null { + val = val.trim(); + + switch (this.getType()) { + + case "TE": + this._answer = new ProfilingAnswer(this.questionId, [val]); + break + + case "MC": + let current_values: string[] = this._answer?.values + current_values.push(val) + this._answer = new ProfilingAnswer(this.questionId, current_values); + break + + default: + throw new Error("Incorrect Question Type provided"); + } + + this.validate() + } + + removeAnswer(val: string): null { + switch (this.getType()) { + + // You can only remove a value from a MultiChoice + case "MC": + // TODO: implement this + // let current_values: string[] = this._answer?.values + // current_values.push(val) + // this._answer = new ProfilingAnswer(this.questionId, current_values); + break + + default: + throw new Error("Incorrect Question Type provided"); + } + + this.validate() + } + + validate(): boolean { + /* + If the question is MC, validate: + - validate selector SA vs MA (1 selected vs >1 selected) + - the answers match actual codes in the choices + - validate configuration.max_select + - validate choices.exclusive + + If the question is TE, validate that: + - configuration.max_length + - validation.patterns + */ + + if (this._answer == null) { + this.error_msg = "An answer is required" + return false + } + + let qa: ProfilingAnswer = this._answer; + + switch (this.getType()) { + case "TE": + if (qa.values.length == 0) { + this.error_msg = "An answer is required" + return false + } + + if (qa.values.length > 1) { + this.error_msg = "Only one answer allowed" + return false + } + + let answer: string = qa.values[0] + + if (answer.length <= 0) { + this.error_msg = "Must provide answer" + return false + } + + const max_length: number = (this.configuration ?? {})["max_length"] ?? 100000 + + if (answer.length > max_length) { + this.error_msg = "Answer longer than allowed" + return false + } + + const patterns: PatternType[] = (this.validation ?? {})["patterns"] ?? [] + + patterns.forEach((pattern) => { + let re = new RegExp(pattern["pattern"]) + if (answer.search(re) == -1) { + this.error_msg = pattern["message"] + return false + } + }) + + this.error_msg = "" + return true + + case "MC": + // if (qa.values.length == 0) { + // this.error_msg = "MC question with no selected answers" + // return false + // } + // + // const choice_codes = map(this.getChoices().toJSON(), "choice_id") + // + // switch (this.getSelector()) { + // case "SA": + // if (qa.values.length > 1) { + // this.error_msg = "Single Answer MC question with >1 selected answers" + // return false + // } + // break + // case "MA": + // if (qa.values.length > choice_codes.length) { + // this.error_msg = "More options selected than allowed" + // return false + // } + // break + // } + // + // if (!every(qa.values, (v) => { + // return includes(choice_codes, v["value"]) + // })) { + // this.error_msg = "Invalid Options Selected" + // return false + // } + // + // const max_select: number = (this.configuration ?? {})["max_select"] ?? choice_codes.length + // if (qa.values.length > max_select) { + // this.error_msg = "More options selected than allowed" + // return false + // } + + /* + exclusive_choice = next((x for x in question["choices"] if x.get("exclusive")), None) + if exclusive_choice: + exclusive_choice_id = exclusive_choice["choice_id"] + assert answer == [exclusive_choice_id] or \ + exclusive_choice_id not in answer, "Invalid exclusive selection" + */ + + this.error_msg = "" + return true + + default: + throw new Error("Incorrect Question Type provided"); + } + + } + + // -- Database / Format -- + static fromJson(json: any): ProfilingQuestion { + return new ProfilingQuestion(json); + } + + save() { + let question: ProfilingQuestion = this; + // @ts-ignore + let answer: ProfilingAnswer = question._answer; + + if (this._complete || this._processing) { + return + } + this._processing = true + + let res = JSON.stringify({ + "answers": [{ + "question_id": answer.get('question_id'), + "answer": map(answer.get("values"), "value") + }] + }); + + $.ajax({ + url: ["https://fsb.generalresearch.com", questions.BPID, "profiling-questions", ""].join("/") + "?" + stringify({"bpuid": questions.BPUID}), + xhrFields: {withCredentials: false}, + processData: false, + type: "POST", + contentType: "application/json; charset=utf-8", + data: res, + success: function (data) { + channel.trigger("ProfilingQuestions:start"); + }, + error: function (data) { + channel.trigger("ProfilingQuestions:start"); + Sentry.captureMessage("Profiling Question submission failed."); + } + }); + } + +}
\ No newline at end of file diff --git a/src/models/questionSlice.ts b/src/models/questionSlice.ts new file mode 100644 index 0000000..6a4da6f --- /dev/null +++ b/src/models/questionSlice.ts @@ -0,0 +1,36 @@ +import {createSlice, PayloadAction} from '@reduxjs/toolkit' +import type {RootState} from '@/store' +import {UpkQuestion} from "@/api/models/upk-question.ts" + +const initialState: UpkQuestion[] = [] + +// Create the slice and pass in the initial state +const questionSlice = createSlice({ + name: 'questions', + initialState, + reducers: { + setQuestions(state, action: PayloadAction<UpkQuestion[]>) { + return action.payload; + }, + questionAdded(state, action: PayloadAction<UpkQuestion>) { + state.push(action.payload); + }, + setAnswer(state, action: PayloadAction<{ questionId: string, val: string }>) { + const {questionId, val} = action.payload + console.log(questionId, val) + const existingQuestion = state.find(q => q.questionId === action.payload.questionId) + if (existingQuestion) { + // existingQuestion.addAnswer(action.payload.val) + // existingQuestion.error_msg = "yess" + } + } + } +}) + +// Export the generated reducer function +export const {setAnswer, setQuestions, questionAdded, questionUpdated} = questionSlice.actions; +export default questionSlice.reducer + +export const selectAllQuestions = (state: RootState) => state.questions + +export const selectQuestionById = (state: RootState, questionId: string) => state.questions.find(q => q.id === questionId)
\ No newline at end of file diff --git a/src/pages/CashoutMethods.tsx b/src/pages/CashoutMethods.tsx new file mode 100644 index 0000000..86727ee --- /dev/null +++ b/src/pages/CashoutMethods.tsx @@ -0,0 +1,48 @@ +import React, {useEffect, useState} from 'react' + +import {Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle} from "@/components/ui/card.tsx"; +import {GRLWidgetSettings} from "@/Widget.tsx" +import {CashoutMethodsResponse, WalletApi} from "@/api" +import {CashoutMethod} from "@/models/CashoutMethod.ts"; + +const CashoutMethodPreview: React.FC<{ cashout_method: CashoutMethod }> = ({cashout_method}) => { + + return ( + <Card key={cashout_method.id}> + <CardHeader> + {cashout_method.name} + </CardHeader> + + <CardContent> + <img className="blur-xs grayscale" src={cashout_method.imageUrl}/> + </CardContent> + </Card> + ) +} + +const CashoutMethodsPage: React.FC<GRLWidgetSettings> = ({settings}) => { + const [cashoutMethods, setCashoutMethods] = useState([]); + + useEffect(() => { + const x = new WalletApi(); + x.getCashoutMethodsProductIdCashoutMethodsGet(settings.bpid, settings.bpuid) + .then(res => { + const data: CashoutMethodsResponse = res.data; + setCashoutMethods(data.cashout_methods); + }) + .catch(err => console.log(err)); + }, []); // ← empty array means "run once" + + return ( + <div className="grid grid-cols-3 gap-1 p-1"> + { + cashoutMethods.map((m, index) => { + const cm = new CashoutMethod(m); + return <CashoutMethodPreview key={index} cashout_method={cm} />; + }) + } + </div> + ); +} + +export {CashoutMethodsPage}
\ No newline at end of file diff --git a/src/pages/Community.tsx b/src/pages/Community.tsx new file mode 100644 index 0000000..88cb74d --- /dev/null +++ b/src/pages/Community.tsx @@ -0,0 +1,50 @@ +import React, {useEffect, useState} from 'react' + +import {Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle} from "@/components/ui/card.tsx"; +import {GRLWidgetSettings} from "@/Widget.tsx" +import {CashoutMethodsResponse, WalletApi} from "@/api" +import {CashoutMethod} from "@/models/CashoutMethod.ts"; + +const CashoutMethodPreview: React.FC<{ cashout_method: CashoutMethod }> = ({cashout_method}) => { + + console.log("CashoutMethodPreview", cashout_method) + + return ( + <Card key={cashout_method.id}> + <CardHeader> + {cashout_method.name} + </CardHeader> + + <CardContent> + <img className="blur-xs grayscale" src={cashout_method.imageUrl}/> + </CardContent> + </Card> + ) +} + +const CommunityPage: React.FC<GRLWidgetSettings> = ({settings}) => { + const [cashoutMethods, setCashoutMethods] = useState([]); + + useEffect(() => { + const x = new WalletApi(); + x.getCashoutMethodsProductIdCashoutMethodsGet(settings.bpid, settings.bpuid) + .then(res => { + const data: CashoutMethodsResponse = res.data; + setCashoutMethods(data.cashout_methods); + }) + .catch(err => console.log(err)); + }, []); // ← empty array means "run once" + + return ( + <div className="grid grid-cols-3 gap-1 p-1"> + { + cashoutMethods.map((m, index) => { + const cm = new CashoutMethod(m); + return <CashoutMethodPreview key={index} cashout_method={cm} />; + }) + } + </div> + ); +} + +export {CommunityPage}
\ No newline at end of file diff --git a/src/pages/Offerwall.tsx b/src/pages/Offerwall.tsx new file mode 100644 index 0000000..acce696 --- /dev/null +++ b/src/pages/Offerwall.tsx @@ -0,0 +1,101 @@ +import React from 'react' +import {Separator} from "@/components/ui/separator" +import {Link} from '@mui/material'; + +import {Card, CardContent, CardFooter, CardHeader, CardTitle} from "@/components/ui/card.tsx"; +import {ScrollArea} from "@/components/ui/scroll-area.tsx"; +import {CheckIcon, MessageCircleQuestionIcon, XIcon} from "lucide-react" +import {SoftPairBucket} from "@/api/models/soft-pair-bucket.ts" +import {useAppSelector} from '@/hooks' + +const BucketStatus: React.FC<SoftPairBucket> = ({bucket}) => { + switch (bucket.eligibility) { + case "eligible": + return <CheckIcon/>; + case "conditional": + return <MessageCircleQuestionIcon/>; + case "ineligible": + return <XIcon/>; + } +} + +const CallToAction: React.FC<SoftPairBucket> = ({bucket}) => { + switch (bucket.eligibility) { + case "eligible": + return <Link href={bucket.uri}> + <button type="button"> + Start Survey + </button> + </Link>; + case "conditional": + return <button type="button"> + Unlock Survey + </button>; + + case "ineligible": + return <button type="button"> + Ineligible Survey + </button>; + } +} + +const Offerwall = () => { + const buckets = useAppSelector(state => state.buckets) + + return ( + + <div className="grid grid-cols-2 gap-2 p-2"> + + {buckets.map((bucket) => ( + <Card key={`${bucket.id}`}> + <CardHeader> + <BucketStatus bucket={bucket}/> + <CardTitle>Card 1</CardTitle> + </CardHeader> + + <CardContent className="flex items-center gap-2"> + {/*<StarIcon className="w-5 h-5 fill-[#FFD700]"/>*/} + {/*<span className="text-sm">4.5</span>*/} + <CallToAction bucket={bucket}/> + </CardContent> + + <CardFooter> + {/*<PieChart width={100} height=60}>*/} + {/* <Pie*/} + {/* dataKey="p"*/} + {/* startAngle={180}*/} + {/* endAngle={0}*/} + {/* data={bucket.category}*/} + {/* cx="50%"*/} + {/* cy="50%"*/} + {/* // onMouseEnter={this.onPieEnter}*/} + {/* // outerRadius={80}*/} + {/* // label*/} + {/* />*/} + {/*</PieChart>*/} + + <ScrollArea className="w-48 rounded-md border"> + <div className="p-4"> + <h4 className="mb-4 text-sm font-medium leading-none">Tags</h4> + {bucket.contents.map((survey) => ( + <> + <div key={`${bucket.id}-${survey.id}`} className="text-sm"> + {survey.id_code} - {survey.loi} seconds - {survey.payout} cents + </div> + <Separator className="my-2"/> + </> + ))} + </div> + </ScrollArea> + + </CardFooter> + + </Card> + ))} + + </div> + + ) +} + +export {Offerwall}
\ No newline at end of file diff --git a/src/pages/Questions.tsx b/src/pages/Questions.tsx new file mode 100644 index 0000000..13d31c4 --- /dev/null +++ b/src/pages/Questions.tsx @@ -0,0 +1,105 @@ +import React, {useEffect, useState} from 'react' + +import {ProfilingQuestionsApi, UpkQuestionResponse} from "@/api" +import {ProfilingQuestion} from "@/models/question.ts"; +import {setAnswer} from "@/models/questionSlice.ts" +import {UpkQuestion} from "@/api/models/upk-question.ts" +import {Card, CardContent, CardHeader} from "@/components/ui/card.tsx"; +import {useAppDispatch, useAppSelector} from "@/hooks.ts"; + + +const TextEntry: React.FC<{ question: UpkQuestion }> = ({question}) => { + const dispatch = useAppDispatch() + // const buckets = useAppSelector(state => state.buckets) + + const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => { + // Don't allow any input changes after they triggered submission... + if (question._complete || question._processing) { + return + } + + // Assign the input value as an answer to the question + const newValue = event.target.value; + dispatch(setAnswer({questionId: question.questionId, val: newValue})) + }; + + return ( + <Card className="@container/card"> + <CardHeader> + {question.questionText} + </CardHeader> + + <CardContent> + <input type="text" + id="text-entry-input" + aria-describedby="" + placeholder="" + onInput={handleInputChange} + /> + <small id="text-entry-msg">{question.error_msg}</small> + </CardContent> + </Card> + ) +} + +const MultipleChoice: React.FC<{ question: UpkQuestion }> = ({question}) => { + + return ( + <Card> + <CardHeader> + {question.questionText} + </CardHeader> + + <CardContent> + <p>MultipleChoice ... </p> + </CardContent> + </Card> + ) +} + + +const ProfileQuestionFull: React.FC<{ question: UpkQuestion }> = ({question}) => { + console.log("ProfileQuestionFull", question, question) + + switch (question.questionType) { + case "TE": + return <TextEntry question={question}/> + + case "MC": + return <MultipleChoice question={question}/> + + default: + throw new Error("Incorrect Question Type provided"); + } +} + +const ProfileQuestionPreview: React.FC<{ question: UpkQuestion }> = ({question}) => { + + return ( + <div> + {question.questionText} + </div> + ) +}; + +const QuestionsPage = () => { + const questions = useAppSelector(state => state.questions) + + return ( + <div> + <p> + A total of {questions.length} questions are available. + </p> + + { + questions.forEach(q => { + return <ProfileQuestionFull key={q.questionId} question={q} className="mt-4 mb-4"/>; + }) + } + </div> + ); +} + +export { + QuestionsPage +}
\ No newline at end of file diff --git a/src/pages/Support.tsx b/src/pages/Support.tsx new file mode 100644 index 0000000..4746b77 --- /dev/null +++ b/src/pages/Support.tsx @@ -0,0 +1,38 @@ +import React, { useEffect } from 'react'; + +const ChatwootLoader = () => { + useEffect(() => { + const loadChatwoot = () => { + const BASE_URL = "https://chat.g-r-l.com"; + const script = document.createElement('script'); + script.src = `${BASE_URL}/packs/js/sdk.js`; + script.defer = true; + script.async = true; + + script.onload = () => { + if (window.chatwootSDK) { + window.chatwootSDK.run({ + websiteToken: 'dEEw3fcexQvnQ5tesJPKFjSb', + baseUrl: BASE_URL, + }); + } + }; + + document.body.appendChild(script); + }; + + loadChatwoot(); + + // Clean up script when the component unmounts + return () => { + const existingScript = document.querySelector(`script[src="https://app.chatwoot.com/packs/js/sdk.js"]`); + if (existingScript) { + document.body.removeChild(existingScript); + } + }; + }, []); + + return null; +}; + +export {ChatwootLoader};
\ No newline at end of file diff --git a/src/store.ts b/src/store.ts new file mode 100644 index 0000000..4bd54ca --- /dev/null +++ b/src/store.ts @@ -0,0 +1,28 @@ +import type {Action, ThunkAction} from '@reduxjs/toolkit' +import {configureStore} from '@reduxjs/toolkit' +import bucketReducers from "@/models/bucketSlice.ts" +import questionReducers from "@/models/questionSlice.ts" +import appReducers from "@/models/appSlice.ts" + +export const store = configureStore({ + reducer: { + app: appReducers, + buckets: bucketReducers, + questions: questionReducers + } +}) + +// Infer the type of `store` +export type AppStore = typeof store +// Infer the `AppDispatch` type from the store itself +export type AppDispatch = typeof store.dispatch +// Same for the `RootState` type +export type RootState = ReturnType<typeof store.getState> + +// Define a reusable type describing thunk functions +export type AppThunk<ThunkReturnType = void> = ThunkAction< + ThunkReturnType, + RootState, + unknown, + Action +>
\ No newline at end of file diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..b6b46b9 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,74 @@ +/* ------ Generic ------ */ +export interface GRLWidgetSettings { + targetId: string, + bpid: string; + bpuid: string; + offerwall: string; + walletMode: boolean; + panelName: string | null; + leaderboard: boolean; +} + +/* ------ Buckets ------ */ + +/* ------ Profiling Questions ------ */ +export type QuestionType = "MC" | "TE" +export type SelectorType = "SL" | "ML" | "SA" | "MA" + +export interface PatternType { + message: string + pattern: string +} + +export interface ValidationType { + patterns: PatternType[] +} + +export interface ChoiceType { + order: number; // 0 index + choice_id: string; // string of a number + choice_text: string + + exclusive?: boolean + task_count?: number + task_score?: number +} + +export interface ConfigurationType { + max_length?: number + max_select?: number +} + +export interface ProfilingQuestionType { + $comment?: string + + choices: ChoiceType[] + validation: ValidationType + configuration: ConfigurationType + + country_iso: string + language_iso: string + + question_id: string + question_text: string + question_type: QuestionType + + selector: SelectorType + task_count?: number + task_score: number + p: number + + // Private! + _complete: boolean + _processing: boolean + _answer: string[] +} + +export interface AnswerValueItemType { + value: string +} + +export interface AnswerType { + question_id: string + values: AnswerValueItemType[] +}
\ No newline at end of file |
