diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..cea9a39 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +REACT_APP_API_URL=http://localhost:8000 \ No newline at end of file diff --git a/README.md b/README.md index 897dc83..1bbb36e 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,3 @@ -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). +# Gitcom frontend -## Available Scripts - -In the project directory, you can run: - -### `npm start` - -Runs the app in the development mode.
-Open [http://localhost:3000](http://localhost:3000) to view it in the browser. - -The page will reload if you make edits.
-You will also see any lint errors in the console. - -### `npm test` - -Launches the test runner in the interactive watch mode.
-See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. - -### `npm run build` - -Builds the app for production to the `build` folder.
-It correctly bundles React in production mode and optimizes the build for the best performance. - -The build is minified and the filenames include the hashes.
-Your app is ready to be deployed! - -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. - -### `npm run eject` - -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** - -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. - -Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. - -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. - -## Learn More - -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/). +Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. diff --git a/package.json b/package.json index ee26183..bca5afe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gitcom-front", - "version": "0.9.0", + "version": "0.10.0", "private": true, "dependencies": { "@azure/ms-rest-js": "^2.0.1", diff --git a/public/index.html b/public/index.html index 358777d..c0c268c 100644 --- a/public/index.html +++ b/public/index.html @@ -4,6 +4,8 @@ + + diff --git a/public/robots.txt b/public/robots.txt index 14267e9..2c294ec 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,2 +1,3 @@ User-agent: * -Allow: / \ No newline at end of file +Allow: / +SITEMAP: https://gitcom.org/sitemap.xml \ No newline at end of file diff --git a/public/sitemap.xml b/public/sitemap.xml new file mode 100644 index 0000000..b177238 --- /dev/null +++ b/public/sitemap.xml @@ -0,0 +1,20 @@ + + + + + https://gitcom.org/ + 2019-12-02T01:47:20+00:00 + 1.00 + + + https://gitcom.org/login + 2019-12-02T01:47:20+00:00 + 0.80 + + + + \ No newline at end of file diff --git a/src/Routes.tsx b/src/Routes.tsx index 7c91028..e01b322 100644 --- a/src/Routes.tsx +++ b/src/Routes.tsx @@ -11,11 +11,18 @@ import LoginWithGitLabLayout from "./layouts/auth/external/gitlab/logInWith/Logi import LoginWithGitHubLayout from "./layouts/auth/external/github/loginWith/LoginWithGitHubLayout"; import ExternalRepoLayout from "./layouts/repos/external/default/ExternalRepoLayout"; import ProjectImportLayout from "./layouts/import/project/ProjectImportLayout"; -import ProjectPage from "./layouts/entity/project/page/ProjectPage"; +import ProjectPage from "./layouts/entity/project/view/ProjectPage"; import BoardPage from "./layouts/entity/board/page/BoardPage"; import SubscriptionLayout from "./layouts/account/subscription/SubscriptionLayout"; import LibraryLayout from "./layouts/account/library/LibraryLayout"; import EditProjectLayout from "./layouts/entity/project/edit/EditProjectLayout"; +import ProjectPricingLayout from "./layouts/entity/project/pricing/view/ProjectPricingLayout"; +import RegisterLayout from "./layouts/auth/register/RegisterLayout"; +import ConfirmEmailLayout from "./layouts/auth/confirmEmail/ConfirmEmailLayout"; +import NotFoundLayout from "./layouts/404/NotFoundLayout"; +import HelpLayout from "./layouts/help/HelpLayout"; +import EditProjectPricingLayout from "./layouts/entity/project/pricing/edit/EditProjectPricingLayout"; +import WithdrawalsLayout from "./layouts/account/withdrawals/WithdrawalsLayout"; class Routes extends React.Component { render() { @@ -23,7 +30,16 @@ class Routes extends React.Component {
+ + {/* Auth */} + + + + + + {/* Home */} + @@ -31,6 +47,7 @@ class Routes extends React.Component { + @@ -49,7 +66,12 @@ class Routes extends React.Component { + + + + +
); diff --git a/src/app.css b/src/app.css index 6cba1c1..75d96b9 100644 --- a/src/app.css +++ b/src/app.css @@ -126,6 +126,10 @@ p, b { cursor: pointer; } +.select-padding > div { + padding: 0 25px; +} + @media only screen and (min-width: 767px) { .desktop-zero-height { height: 0; diff --git a/src/classes/dataStore/app.tsx b/src/classes/dataStore/app.tsx index a63732a..cc9e82a 100644 --- a/src/classes/dataStore/app.tsx +++ b/src/classes/dataStore/app.tsx @@ -10,7 +10,7 @@ class App { authorizedUser: UserModel|null = null; constructor(props: any) { - this.apiClient = new SupportHubApi({ + this.apiClient = new SupportHubApi('Card', { baseUri: window.AppConfig.api_url }); diff --git a/src/classes/notification/errorHandler/errorHandler.ts b/src/classes/notification/errorHandler/errorHandler.ts index e93382c..eda00c4 100644 --- a/src/classes/notification/errorHandler/errorHandler.ts +++ b/src/classes/notification/errorHandler/errorHandler.ts @@ -1,15 +1,23 @@ import {notification} from "antd"; export function handleApiError(response: any): void { - // TODO: only in dev mode - console.error('RAW error response:'); - console.error(response); + if (process.env.NODE_ENV === "development") { + console.error('RAW error response:'); + console.error(response); + } if (!response) { showUnknownError(); return; } let json: any; try { + if (response.status === 401) { + notification['error']({ + message: 'Unauthorized, please log in again', + description: '' + }); + return; + } if (response.status === 404) { notification['error']({ message: 'Not found', @@ -17,7 +25,21 @@ export function handleApiError(response: any): void { }); return; } - json = JSON.parse(response); + json = JSON.parse(response.body); + if (response.status === 403) { + notification['error']({ + message: 'Not allowed', + description: json.errors[0].message + }); + return; + } + if (response.status === 422) { + notification['error']({ + message: 'Submitted form is invalid, please try again', + description: json.errors[0].message + }); + return; + } } catch (e) { showUnknownError(e); return; @@ -32,7 +54,6 @@ export function handleApiError(response: any): void { export function showUnknownError(err: any = null) { if (err) { - // TODO: only in dev mode console.error(err); } console.error('Unknown error, we\'re already working on it :)'); diff --git a/src/classes/utils/http/retryRequest.ts b/src/classes/utils/http/retryRequest.ts new file mode 100644 index 0000000..5ff8654 --- /dev/null +++ b/src/classes/utils/http/retryRequest.ts @@ -0,0 +1,18 @@ +export function retryRequest(funcToExec: any, getTargetRef: any, targetValue: any, retryCount: number = 7) { + let execCount = 0; + executeFunc(funcToExec, execCount, getTargetRef, targetValue, retryCount); +} + +function executeFunc(funcToExec: any, execCount: number, getTargetRef: any, targetValue: any, retryCount: number) { + try { + if (execCount < retryCount && getTargetRef() !== targetValue) { + setTimeout(() => { + funcToExec(); + executeFunc(funcToExec, execCount, getTargetRef, targetValue, retryCount); + }, 500 + (500 * execCount)); + execCount++; + } + } catch (e) { + // ignored + } +} diff --git a/src/client/bindings.ts b/src/client/bindings.ts index 9325ed8..e7ee678 100644 --- a/src/client/bindings.ts +++ b/src/client/bindings.ts @@ -1,4 +1,4 @@ -import {CurrencyType, CurrencyType1, CurrencyType3, EntityType, EntityType1, UserBalance} from "./models"; +import {CurrencyType, CurrencyType1, CurrencyType3, EntityType} from "./models"; export class ProjectModel { guid?: string; @@ -7,6 +7,7 @@ export class ProjectModel { repository_guid?: string; creator_guid?: string; base_uri?: string; + stars_count?: number; created_at?: string; updated_at?: string; } @@ -82,7 +83,7 @@ export class InvoiceModel { * Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', 'BacklogItem', * 'UserBalance' */ - entity_type?: EntityType1; + entity_type?: EntityType; amount?: number; status?: string; /** @@ -131,3 +132,27 @@ export class LibraryItem { created_at?: string; } +export class ProjectProduct { + guid?: string; + name?: string; + description?: string; + /** + * url to view product info (optional) + */ + url?: string; + project_guid?: string; + usd_price?: number; + duration_hours?: number; + users_count?: number; + created_at?: string; + updated_at?: string; +} + +export interface WithdrawalRequest { + guid?: string; + user_guid?: string; + amount?: number; + address?: string; + paid?: boolean; + created_at?: string; +} diff --git a/src/client/models/index.ts b/src/client/models/index.ts index db996d3..485c1a3 100644 --- a/src/client/models/index.ts +++ b/src/client/models/index.ts @@ -47,6 +47,7 @@ export interface Project { repositoryGuid?: string; creatorGuid?: string; baseUri?: string; + starsCount?: number; createdAt?: string; updatedAt?: string; } @@ -133,7 +134,7 @@ export interface FundingBalance { entityGuid?: string; /** * Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', 'BacklogItem', - * 'UserBalance', 'User' + * 'UserBalance', 'User', 'ProjectProductPurchase', 'BoardColumn' */ entityType?: EntityType; amount?: number; @@ -166,7 +167,7 @@ export interface Invoice { entityGuid?: string; /** * Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', 'BacklogItem', - * 'UserBalance', 'User' + * 'UserBalance', 'User', 'ProjectProductPurchase', 'BoardColumn' */ entityType?: EntityType1; amount?: number; @@ -216,6 +217,39 @@ export interface LibraryItem { createdAt?: string; } +/** + * An interface representing ProjectProduct. + */ +export interface ProjectProduct { + guid?: string; + name?: string; + description?: string; + /** + * url to view product info (optional) + */ + url?: string; + projectGuid?: string; + usdPrice?: number; + durationHours?: number; + createdAt?: string; + updatedAt?: string; +} + +/** + * An interface representing WithdrawalRequest. + */ +export interface WithdrawalRequest { + guid?: string; + userGuid?: string; + amount?: number; + /** + * Users email for PayPal or cryptocurrency address + */ + address?: string; + paid?: boolean; + createdAt?: string; +} + /** * An interface representing GetLoginOKResponseData. */ @@ -230,6 +264,34 @@ export interface GetLoginOKResponse { data?: GetLoginOKResponseData; } +/** + * An interface representing PostRegisterOKResponseData. + */ +export interface PostRegisterOKResponseData { + response?: string; +} + +/** + * An interface representing PostRegisterOKResponse. + */ +export interface PostRegisterOKResponse { + data?: PostRegisterOKResponseData; +} + +/** + * An interface representing PostConfirmEmailOKResponseData. + */ +export interface PostConfirmEmailOKResponseData { + token?: string; +} + +/** + * An interface representing PostConfirmEmailOKResponse. + */ +export interface PostConfirmEmailOKResponse { + data?: PostConfirmEmailOKResponseData; +} + /** * An interface representing GetGitHubLoginLinkOKResponseData. */ @@ -369,6 +431,20 @@ export interface PostImportRepositoryOKResponse { data?: PostImportRepositoryOKResponseData; } +/** + * An interface representing GetRepoOKResponseData. + */ +export interface GetRepoOKResponseData { + repository?: Repository; +} + +/** + * An interface representing GetRepoOKResponse. + */ +export interface GetRepoOKResponse { + data?: GetRepoOKResponseData; +} + /** * An interface representing GetProjectOKResponseData. */ @@ -467,6 +543,34 @@ export interface GetProjectByAliasOKResponse { data?: GetProjectByAliasOKResponseData; } +/** + * An interface representing CreateCardCreatedResponseData. + */ +export interface CreateCardCreatedResponseData { + card?: Card; +} + +/** + * An interface representing CreateCardCreatedResponse. + */ +export interface CreateCardCreatedResponse { + data?: CreateCardCreatedResponseData; +} + +/** + * An interface representing EditCardOKResponseData. + */ +export interface EditCardOKResponseData { + card?: Card; +} + +/** + * An interface representing EditCardOKResponse. + */ +export interface EditCardOKResponse { + data?: EditCardOKResponseData; +} + /** * An interface representing GetCardWorkOKResponseData. */ @@ -691,6 +795,27 @@ export interface RemoveProjectFromMyLibraryOKResponse { data?: RemoveProjectFromMyLibraryOKResponseData; } +/** + * An interface representing GetMyLibraryProjectStatusOKResponseDataStatus. + */ +export interface GetMyLibraryProjectStatusOKResponseDataStatus { + inLibrary?: boolean; +} + +/** + * An interface representing GetMyLibraryProjectStatusOKResponseData. + */ +export interface GetMyLibraryProjectStatusOKResponseData { + status?: GetMyLibraryProjectStatusOKResponseDataStatus; +} + +/** + * An interface representing GetMyLibraryProjectStatusOKResponse. + */ +export interface GetMyLibraryProjectStatusOKResponse { + data?: GetMyLibraryProjectStatusOKResponseData; +} + /** * An interface representing GetMeOKResponseData. */ @@ -789,10 +914,85 @@ export interface GetRandomProjectsOKResponse { data?: GetRandomProjectsOKResponseData; } +/** + * An interface representing GetProjectProductsOKResponseData. + */ +export interface GetProjectProductsOKResponseData { + products?: ProjectProduct[]; +} + +/** + * An interface representing GetProjectProductsOKResponse. + */ +export interface GetProjectProductsOKResponse { + data?: GetProjectProductsOKResponseData; +} + +/** + * An interface representing PostProjectProductCreatedResponseData. + */ +export interface PostProjectProductCreatedResponseData { + product?: ProjectProduct; +} + +/** + * An interface representing PostProjectProductCreatedResponse. + */ +export interface PostProjectProductCreatedResponse { + data?: PostProjectProductCreatedResponseData; +} + +/** + * An interface representing DeleteProjectProductOKResponseData. + */ +export interface DeleteProjectProductOKResponseData { + product?: ProjectProduct; +} + +/** + * An interface representing DeleteProjectProductOKResponse. + */ +export interface DeleteProjectProductOKResponse { + data?: DeleteProjectProductOKResponseData; +} + +/** + * An interface representing GetMyWithdrawalRequestsOKResponseData. + */ +export interface GetMyWithdrawalRequestsOKResponseData { + withdrawRequests?: WithdrawalRequest[]; +} + +/** + * An interface representing GetMyWithdrawalRequestsOKResponse. + */ +export interface GetMyWithdrawalRequestsOKResponse { + data?: GetMyWithdrawalRequestsOKResponseData; +} + +/** + * An interface representing PostWithdrawalRequestCreatedResponseData. + */ +export interface PostWithdrawalRequestCreatedResponseData { + withdrawRequest?: WithdrawalRequest; +} + +/** + * An interface representing PostWithdrawalRequestCreatedResponse. + */ +export interface PostWithdrawalRequestCreatedResponse { + data?: PostWithdrawalRequestCreatedResponseData; +} + /** * An interface representing SupportHubApiOptions. */ export interface SupportHubApiOptions extends ServiceClientOptions { + /** + * Possible values include: 'Usd', 'BitCoin', 'Ethereum', 'Erc20Token', 'Waves', 'WavesToken', + * 'LiteCoin' + */ + currencyType?: CurrencyType4; baseUri?: string; } @@ -804,6 +1004,13 @@ export interface SupportHubApiGetLoginOptionalParams extends msRest.RequestOptio password?: string; } +/** + * Optional Parameters. + */ +export interface SupportHubApiPostRegisterOptionalParams extends msRest.RequestOptionsBase { + referralKey?: string; +} + /** * Optional Parameters. */ @@ -834,6 +1041,31 @@ export interface SupportHubApiEditProjectOptionalParams extends msRest.RequestOp description?: string; } +/** + * Optional Parameters. + */ +export interface SupportHubApiCreateCardOptionalParams extends msRest.RequestOptionsBase { + description?: string; + columnOrder?: number; +} + +/** + * Optional Parameters. + */ +export interface SupportHubApiEditCardOptionalParams extends msRest.RequestOptionsBase { + name?: string; + description?: string; + columnOrder?: number; + columnGuid?: string; +} + +/** + * Optional Parameters. + */ +export interface SupportHubApiPostProjectProductOptionalParams extends msRest.RequestOptionsBase { + durationHours?: number; +} + /** * Defines values for ServiceType. * Possible values include: 'GitHub', 'GitLab' @@ -845,11 +1077,11 @@ export type ServiceType = 'GitHub' | 'GitLab'; /** * Defines values for EntityType. * Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', 'BacklogItem', - * 'UserBalance', 'User' + * 'UserBalance', 'User', 'ProjectProductPurchase', 'BoardColumn' * @readonly * @enum {string} */ -export type EntityType = 'ProjectCategory' | 'Project' | 'Board' | 'Card' | 'BacklogItem' | 'UserBalance' | 'User'; +export type EntityType = 'ProjectCategory' | 'Project' | 'Board' | 'Card' | 'BacklogItem' | 'UserBalance' | 'User' | 'ProjectProductPurchase' | 'BoardColumn'; /** * Defines values for CurrencyType. @@ -872,11 +1104,11 @@ export type CurrencyType1 = 'Usd' | 'BitCoin' | 'Ethereum' | 'Erc20Token' | 'Wav /** * Defines values for EntityType1. * Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', 'BacklogItem', - * 'UserBalance', 'User' + * 'UserBalance', 'User', 'ProjectProductPurchase', 'BoardColumn' * @readonly * @enum {string} */ -export type EntityType1 = 'ProjectCategory' | 'Project' | 'Board' | 'Card' | 'BacklogItem' | 'UserBalance' | 'User'; +export type EntityType1 = 'ProjectCategory' | 'Project' | 'Board' | 'Card' | 'BacklogItem' | 'UserBalance' | 'User' | 'ProjectProductPurchase' | 'BoardColumn'; /** * Defines values for CurrencyType2. @@ -896,6 +1128,15 @@ export type CurrencyType2 = 'Usd' | 'BitCoin' | 'Ethereum' | 'Erc20Token' | 'Wav */ export type CurrencyType3 = 'Usd' | 'BitCoin' | 'Ethereum' | 'Erc20Token' | 'Waves' | 'WavesToken' | 'LiteCoin'; +/** + * Defines values for CurrencyType4. + * Possible values include: 'Usd', 'BitCoin', 'Ethereum', 'Erc20Token', 'Waves', 'WavesToken', + * 'LiteCoin' + * @readonly + * @enum {string} + */ +export type CurrencyType4 = 'Usd' | 'BitCoin' | 'Ethereum' | 'Erc20Token' | 'Waves' | 'WavesToken' | 'LiteCoin'; + /** * Defines values for ServiceType1. * Possible values include: 'GitHub', 'GitLab' @@ -907,37 +1148,47 @@ export type ServiceType1 = 'GitHub' | 'GitLab'; /** * Defines values for EntityType2. * Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', 'BacklogItem', - * 'UserBalance', 'User' + * 'UserBalance', 'User', 'ProjectProductPurchase', 'BoardColumn' * @readonly * @enum {string} */ -export type EntityType2 = 'ProjectCategory' | 'Project' | 'Board' | 'Card' | 'BacklogItem' | 'UserBalance' | 'User'; +export type EntityType2 = 'ProjectCategory' | 'Project' | 'Board' | 'Card' | 'BacklogItem' | 'UserBalance' | 'User' | 'ProjectProductPurchase' | 'BoardColumn'; /** * Defines values for EntityType3. * Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', 'BacklogItem', - * 'UserBalance', 'User' + * 'UserBalance', 'User', 'ProjectProductPurchase', 'BoardColumn' * @readonly * @enum {string} */ -export type EntityType3 = 'ProjectCategory' | 'Project' | 'Board' | 'Card' | 'BacklogItem' | 'UserBalance' | 'User'; +export type EntityType3 = 'ProjectCategory' | 'Project' | 'Board' | 'Card' | 'BacklogItem' | 'UserBalance' | 'User' | 'ProjectProductPurchase' | 'BoardColumn'; /** - * Defines values for CurrencyType4. + * Defines values for CurrencyType5. * Possible values include: 'Usd', 'BitCoin', 'Ethereum', 'Erc20Token', 'Waves', 'WavesToken', * 'LiteCoin' * @readonly * @enum {string} */ -export type CurrencyType4 = 'Usd' | 'BitCoin' | 'Ethereum' | 'Erc20Token' | 'Waves' | 'WavesToken' | 'LiteCoin'; +export type CurrencyType5 = 'Usd' | 'BitCoin' | 'Ethereum' | 'Erc20Token' | 'Waves' | 'WavesToken' | 'LiteCoin'; /** * Defines values for EntityType4. - * Possible values include: 'Project', 'Board', 'BoardColumn', 'Card' + * Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', 'BacklogItem', + * 'UserBalance', 'User', 'ProjectProductPurchase', 'BoardColumn' + * @readonly + * @enum {string} + */ +export type EntityType4 = 'ProjectCategory' | 'Project' | 'Board' | 'Card' | 'BacklogItem' | 'UserBalance' | 'User' | 'ProjectProductPurchase' | 'BoardColumn'; + +/** + * Defines values for CurrencyType6. + * Possible values include: 'Usd', 'BitCoin', 'Ethereum', 'Erc20Token', 'Waves', 'WavesToken', + * 'LiteCoin' * @readonly * @enum {string} */ -export type EntityType4 = 'Project' | 'Board' | 'BoardColumn' | 'Card'; +export type CurrencyType6 = 'Usd' | 'BitCoin' | 'Ethereum' | 'Erc20Token' | 'Waves' | 'WavesToken' | 'LiteCoin'; /** * Contains response data for the getLogin operation. @@ -959,6 +1210,46 @@ export type GetLoginResponse = GetLoginOKResponse & { }; }; +/** + * Contains response data for the postRegister operation. + */ +export type PostRegisterResponse = PostRegisterOKResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PostRegisterOKResponse; + }; +}; + +/** + * Contains response data for the postConfirmEmail operation. + */ +export type PostConfirmEmailResponse = PostConfirmEmailOKResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PostConfirmEmailOKResponse; + }; +}; + /** * Contains response data for the getGitHubLoginLink operation. */ @@ -1099,6 +1390,26 @@ export type PostImportRepositoryResponse = PostImportRepositoryOKResponse & { }; }; +/** + * Contains response data for the getRepo operation. + */ +export type GetRepoResponse = GetRepoOKResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GetRepoOKResponse; + }; +}; + /** * Contains response data for the getProject operation. */ @@ -1239,6 +1550,46 @@ export type GetProjectByAliasResponse = GetProjectByAliasOKResponse & { }; }; +/** + * Contains response data for the createCard operation. + */ +export type CreateCardResponse = CreateCardCreatedResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: CreateCardCreatedResponse; + }; +}; + +/** + * Contains response data for the editCard operation. + */ +export type EditCardResponse = EditCardOKResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: EditCardOKResponse; + }; +}; + /** * Contains response data for the getCardWork operation. */ @@ -1559,6 +1910,26 @@ export type RemoveProjectFromMyLibraryResponse = RemoveProjectFromMyLibraryOKRes }; }; +/** + * Contains response data for the getMyLibraryProjectStatus operation. + */ +export type GetMyLibraryProjectStatusResponse = GetMyLibraryProjectStatusOKResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GetMyLibraryProjectStatusOKResponse; + }; +}; + /** * Contains response data for the getMe operation. */ @@ -1698,3 +2069,103 @@ export type GetRandomProjectsResponse = GetRandomProjectsOKResponse & { parsedBody: GetRandomProjectsOKResponse; }; }; + +/** + * Contains response data for the getProjectProducts operation. + */ +export type GetProjectProductsResponse = GetProjectProductsOKResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GetProjectProductsOKResponse; + }; +}; + +/** + * Contains response data for the postProjectProduct operation. + */ +export type PostProjectProductResponse = PostProjectProductCreatedResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PostProjectProductCreatedResponse; + }; +}; + +/** + * Contains response data for the deleteProjectProduct operation. + */ +export type DeleteProjectProductResponse = DeleteProjectProductOKResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: DeleteProjectProductOKResponse; + }; +}; + +/** + * Contains response data for the getMyWithdrawalRequests operation. + */ +export type GetMyWithdrawalRequestsResponse = GetMyWithdrawalRequestsOKResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: GetMyWithdrawalRequestsOKResponse; + }; +}; + +/** + * Contains response data for the postWithdrawalRequest operation. + */ +export type PostWithdrawalRequestResponse = PostWithdrawalRequestCreatedResponse & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: PostWithdrawalRequestCreatedResponse; + }; +}; diff --git a/src/client/models/mappers.ts b/src/client/models/mappers.ts index cf2cfd0..3a61976 100644 --- a/src/client/models/mappers.ts +++ b/src/client/models/mappers.ts @@ -139,6 +139,12 @@ export const Project: msRest.CompositeMapper = { name: "String" } }, + starsCount: { + serializedName: "stars_count", + type: { + name: "Number" + } + }, createdAt: { serializedName: "created_at", type: { @@ -692,6 +698,116 @@ export const LibraryItem: msRest.CompositeMapper = { } }; +export const ProjectProduct: msRest.CompositeMapper = { + serializedName: "ProjectProduct", + type: { + name: "Composite", + className: "ProjectProduct", + modelProperties: { + guid: { + serializedName: "guid", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + url: { + serializedName: "url", + type: { + name: "String" + } + }, + projectGuid: { + serializedName: "project_guid", + type: { + name: "String" + } + }, + usdPrice: { + serializedName: "usd_price", + type: { + name: "Number" + } + }, + durationHours: { + serializedName: "duration_hours", + type: { + name: "Number" + } + }, + createdAt: { + serializedName: "created_at", + type: { + name: "String" + } + }, + updatedAt: { + serializedName: "updated_at", + type: { + name: "String" + } + } + } + } +}; + +export const WithdrawalRequest: msRest.CompositeMapper = { + serializedName: "WithdrawalRequest", + type: { + name: "Composite", + className: "WithdrawalRequest", + modelProperties: { + guid: { + serializedName: "guid", + type: { + name: "String" + } + }, + userGuid: { + serializedName: "user_guid", + type: { + name: "String" + } + }, + amount: { + serializedName: "amount", + type: { + name: "Number" + } + }, + address: { + serializedName: "address", + type: { + name: "String" + } + }, + paid: { + serializedName: "paid", + type: { + name: "Boolean" + } + }, + createdAt: { + serializedName: "created_at", + type: { + name: "String" + } + } + } + } +}; + export const GetLoginOKResponseData: msRest.CompositeMapper = { serializedName: "GetLoginOKResponse_data", type: { @@ -725,6 +841,72 @@ export const GetLoginOKResponse: msRest.CompositeMapper = { } }; +export const PostRegisterOKResponseData: msRest.CompositeMapper = { + serializedName: "PostRegisterOKResponse_data", + type: { + name: "Composite", + className: "PostRegisterOKResponseData", + modelProperties: { + response: { + serializedName: "response", + type: { + name: "String" + } + } + } + } +}; + +export const PostRegisterOKResponse: msRest.CompositeMapper = { + serializedName: "PostRegisterOKResponse", + type: { + name: "Composite", + className: "PostRegisterOKResponse", + modelProperties: { + data: { + serializedName: "data", + type: { + name: "Composite", + className: "PostRegisterOKResponseData" + } + } + } + } +}; + +export const PostConfirmEmailOKResponseData: msRest.CompositeMapper = { + serializedName: "PostConfirmEmailOKResponse_data", + type: { + name: "Composite", + className: "PostConfirmEmailOKResponseData", + modelProperties: { + token: { + serializedName: "token", + type: { + name: "String" + } + } + } + } +}; + +export const PostConfirmEmailOKResponse: msRest.CompositeMapper = { + serializedName: "PostConfirmEmailOKResponse", + type: { + name: "Composite", + className: "PostConfirmEmailOKResponse", + modelProperties: { + data: { + serializedName: "data", + type: { + name: "Composite", + className: "PostConfirmEmailOKResponseData" + } + } + } + } +}; + export const GetGitHubLoginLinkOKResponseData: msRest.CompositeMapper = { serializedName: "GetGitHubLoginLinkOKResponse_data", type: { @@ -1085,6 +1267,40 @@ export const PostImportRepositoryOKResponse: msRest.CompositeMapper = { } }; +export const GetRepoOKResponseData: msRest.CompositeMapper = { + serializedName: "GetRepoOKResponse_data", + type: { + name: "Composite", + className: "GetRepoOKResponseData", + modelProperties: { + repository: { + serializedName: "repository", + type: { + name: "Composite", + className: "Repository" + } + } + } + } +}; + +export const GetRepoOKResponse: msRest.CompositeMapper = { + serializedName: "GetRepoOKResponse", + type: { + name: "Composite", + className: "GetRepoOKResponse", + modelProperties: { + data: { + serializedName: "data", + type: { + name: "Composite", + className: "GetRepoOKResponseData" + } + } + } + } +}; + export const GetProjectOKResponseData: msRest.CompositeMapper = { serializedName: "GetProjectOKResponse_data", type: { @@ -1338,6 +1554,74 @@ export const GetProjectByAliasOKResponse: msRest.CompositeMapper = { } }; +export const CreateCardCreatedResponseData: msRest.CompositeMapper = { + serializedName: "CreateCardCreatedResponse_data", + type: { + name: "Composite", + className: "CreateCardCreatedResponseData", + modelProperties: { + card: { + serializedName: "card", + type: { + name: "Composite", + className: "Card" + } + } + } + } +}; + +export const CreateCardCreatedResponse: msRest.CompositeMapper = { + serializedName: "CreateCardCreatedResponse", + type: { + name: "Composite", + className: "CreateCardCreatedResponse", + modelProperties: { + data: { + serializedName: "data", + type: { + name: "Composite", + className: "CreateCardCreatedResponseData" + } + } + } + } +}; + +export const EditCardOKResponseData: msRest.CompositeMapper = { + serializedName: "EditCardOKResponse_data", + type: { + name: "Composite", + className: "EditCardOKResponseData", + modelProperties: { + card: { + serializedName: "card", + type: { + name: "Composite", + className: "Card" + } + } + } + } +}; + +export const EditCardOKResponse: msRest.CompositeMapper = { + serializedName: "EditCardOKResponse", + type: { + name: "Composite", + className: "EditCardOKResponse", + modelProperties: { + data: { + serializedName: "data", + type: { + name: "Composite", + className: "EditCardOKResponseData" + } + } + } + } +}; + export const GetCardWorkOKResponseData: msRest.CompositeMapper = { serializedName: "GetCardWorkOKResponse_data", type: { @@ -1912,6 +2196,56 @@ export const RemoveProjectFromMyLibraryOKResponse: msRest.CompositeMapper = { } }; +export const GetMyLibraryProjectStatusOKResponseDataStatus: msRest.CompositeMapper = { + serializedName: "GetMyLibraryProjectStatusOKResponse_data_status", + type: { + name: "Composite", + className: "GetMyLibraryProjectStatusOKResponseDataStatus", + modelProperties: { + inLibrary: { + serializedName: "in_library", + type: { + name: "Boolean" + } + } + } + } +}; + +export const GetMyLibraryProjectStatusOKResponseData: msRest.CompositeMapper = { + serializedName: "GetMyLibraryProjectStatusOKResponse_data", + type: { + name: "Composite", + className: "GetMyLibraryProjectStatusOKResponseData", + modelProperties: { + status: { + serializedName: "status", + type: { + name: "Composite", + className: "GetMyLibraryProjectStatusOKResponseDataStatus" + } + } + } + } +}; + +export const GetMyLibraryProjectStatusOKResponse: msRest.CompositeMapper = { + serializedName: "GetMyLibraryProjectStatusOKResponse", + type: { + name: "Composite", + className: "GetMyLibraryProjectStatusOKResponse", + modelProperties: { + data: { + serializedName: "data", + type: { + name: "Composite", + className: "GetMyLibraryProjectStatusOKResponseData" + } + } + } + } +}; + export const GetMeOKResponseData: msRest.CompositeMapper = { serializedName: "GetMeOKResponse_data", type: { @@ -2171,3 +2505,183 @@ export const GetRandomProjectsOKResponse: msRest.CompositeMapper = { } } }; + +export const GetProjectProductsOKResponseData: msRest.CompositeMapper = { + serializedName: "GetProjectProductsOKResponse_data", + type: { + name: "Composite", + className: "GetProjectProductsOKResponseData", + modelProperties: { + products: { + serializedName: "products", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ProjectProduct" + } + } + } + } + } + } +}; + +export const GetProjectProductsOKResponse: msRest.CompositeMapper = { + serializedName: "GetProjectProductsOKResponse", + type: { + name: "Composite", + className: "GetProjectProductsOKResponse", + modelProperties: { + data: { + serializedName: "data", + type: { + name: "Composite", + className: "GetProjectProductsOKResponseData" + } + } + } + } +}; + +export const PostProjectProductCreatedResponseData: msRest.CompositeMapper = { + serializedName: "PostProjectProductCreatedResponse_data", + type: { + name: "Composite", + className: "PostProjectProductCreatedResponseData", + modelProperties: { + product: { + serializedName: "product", + type: { + name: "Composite", + className: "ProjectProduct" + } + } + } + } +}; + +export const PostProjectProductCreatedResponse: msRest.CompositeMapper = { + serializedName: "PostProjectProductCreatedResponse", + type: { + name: "Composite", + className: "PostProjectProductCreatedResponse", + modelProperties: { + data: { + serializedName: "data", + type: { + name: "Composite", + className: "PostProjectProductCreatedResponseData" + } + } + } + } +}; + +export const DeleteProjectProductOKResponseData: msRest.CompositeMapper = { + serializedName: "DeleteProjectProductOKResponse_data", + type: { + name: "Composite", + className: "DeleteProjectProductOKResponseData", + modelProperties: { + product: { + serializedName: "product", + type: { + name: "Composite", + className: "ProjectProduct" + } + } + } + } +}; + +export const DeleteProjectProductOKResponse: msRest.CompositeMapper = { + serializedName: "DeleteProjectProductOKResponse", + type: { + name: "Composite", + className: "DeleteProjectProductOKResponse", + modelProperties: { + data: { + serializedName: "data", + type: { + name: "Composite", + className: "DeleteProjectProductOKResponseData" + } + } + } + } +}; + +export const GetMyWithdrawalRequestsOKResponseData: msRest.CompositeMapper = { + serializedName: "GetMyWithdrawalRequestsOKResponse_data", + type: { + name: "Composite", + className: "GetMyWithdrawalRequestsOKResponseData", + modelProperties: { + withdrawRequests: { + serializedName: "withdraw_requests", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "WithdrawalRequest" + } + } + } + } + } + } +}; + +export const GetMyWithdrawalRequestsOKResponse: msRest.CompositeMapper = { + serializedName: "GetMyWithdrawalRequestsOKResponse", + type: { + name: "Composite", + className: "GetMyWithdrawalRequestsOKResponse", + modelProperties: { + data: { + serializedName: "data", + type: { + name: "Composite", + className: "GetMyWithdrawalRequestsOKResponseData" + } + } + } + } +}; + +export const PostWithdrawalRequestCreatedResponseData: msRest.CompositeMapper = { + serializedName: "PostWithdrawalRequestCreatedResponse_data", + type: { + name: "Composite", + className: "PostWithdrawalRequestCreatedResponseData", + modelProperties: { + withdrawRequest: { + serializedName: "withdraw_request", + type: { + name: "Composite", + className: "WithdrawalRequest" + } + } + } + } +}; + +export const PostWithdrawalRequestCreatedResponse: msRest.CompositeMapper = { + serializedName: "PostWithdrawalRequestCreatedResponse", + type: { + name: "Composite", + className: "PostWithdrawalRequestCreatedResponse", + modelProperties: { + data: { + serializedName: "data", + type: { + name: "Composite", + className: "PostWithdrawalRequestCreatedResponseData" + } + } + } + } +}; diff --git a/src/client/models/parameters.ts b/src/client/models/parameters.ts index fc0f609..be73951 100644 --- a/src/client/models/parameters.ts +++ b/src/client/models/parameters.ts @@ -18,6 +18,16 @@ export const accessToken: msRest.OperationQueryParameter = { } } }; +export const address: msRest.OperationQueryParameter = { + parameterPath: "address", + mapper: { + required: true, + serializedName: "address", + type: { + name: "String" + } + } +}; export const alias: msRest.OperationQueryParameter = { parameterPath: "alias", mapper: { @@ -80,7 +90,7 @@ export const code: msRest.OperationQueryParameter = { } } }; -export const columnGuid: msRest.OperationQueryParameter = { +export const columnGuid0: msRest.OperationQueryParameter = { parameterPath: "columnGuid", mapper: { required: true, @@ -90,6 +100,40 @@ export const columnGuid: msRest.OperationQueryParameter = { } } }; +export const columnGuid1: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "columnGuid" + ], + mapper: { + serializedName: "column_guid", + type: { + name: "String" + } + } +}; +export const columnOrder: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "columnOrder" + ], + mapper: { + serializedName: "column_order", + type: { + name: "Number" + } + } +}; +export const confirmationKey: msRest.OperationQueryParameter = { + parameterPath: "confirmationKey", + mapper: { + required: true, + serializedName: "confirmation_key", + type: { + name: "String" + } + } +}; export const currencyType: msRest.OperationQueryParameter = { parameterPath: "currencyType", mapper: { @@ -100,7 +144,7 @@ export const currencyType: msRest.OperationQueryParameter = { } } }; -export const description: msRest.OperationQueryParameter = { +export const description0: msRest.OperationQueryParameter = { parameterPath: [ "options", "description" @@ -112,7 +156,29 @@ export const description: msRest.OperationQueryParameter = { } } }; -export const email: msRest.OperationQueryParameter = { +export const description1: msRest.OperationQueryParameter = { + parameterPath: "description", + mapper: { + required: true, + serializedName: "description", + type: { + name: "String" + } + } +}; +export const durationHours: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "durationHours" + ], + mapper: { + serializedName: "duration_hours", + type: { + name: "Number" + } + } +}; +export const email0: msRest.OperationQueryParameter = { parameterPath: [ "options", "email" @@ -124,6 +190,16 @@ export const email: msRest.OperationQueryParameter = { } } }; +export const email1: msRest.OperationQueryParameter = { + parameterPath: "email", + mapper: { + required: true, + serializedName: "email", + type: { + name: "String" + } + } +}; export const entityGuid: msRest.OperationQueryParameter = { parameterPath: "entityGuid", mapper: { @@ -184,6 +260,38 @@ export const key: msRest.OperationQueryParameter = { } } }; +export const login: msRest.OperationQueryParameter = { + parameterPath: "login", + mapper: { + required: true, + serializedName: "login", + type: { + name: "String" + } + } +}; +export const name0: msRest.OperationQueryParameter = { + parameterPath: "name", + mapper: { + required: true, + serializedName: "name", + type: { + name: "String" + } + } +}; +export const name1: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "name" + ], + mapper: { + serializedName: "name", + type: { + name: "String" + } + } +}; export const originId: msRest.OperationQueryParameter = { parameterPath: "originId", mapper: { @@ -204,7 +312,7 @@ export const owner: msRest.OperationQueryParameter = { } } }; -export const password: msRest.OperationQueryParameter = { +export const password0: msRest.OperationQueryParameter = { parameterPath: [ "options", "password" @@ -216,6 +324,26 @@ export const password: msRest.OperationQueryParameter = { } } }; +export const password1: msRest.OperationQueryParameter = { + parameterPath: "password", + mapper: { + required: true, + serializedName: "password", + type: { + name: "String" + } + } +}; +export const productGuid: msRest.OperationQueryParameter = { + parameterPath: "productGuid", + mapper: { + required: true, + serializedName: "product_guid", + type: { + name: "String" + } + } +}; export const projectGuid: msRest.OperationQueryParameter = { parameterPath: "projectGuid", mapper: { @@ -236,6 +364,28 @@ export const proof: msRest.OperationQueryParameter = { } } }; +export const referralKey: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "referralKey" + ], + mapper: { + serializedName: "referral_key", + type: { + name: "String" + } + } +}; +export const repoGuid: msRest.OperationQueryParameter = { + parameterPath: "repoGuid", + mapper: { + required: true, + serializedName: "repo_guid", + type: { + name: "String" + } + } +}; export const serviceType: msRest.OperationQueryParameter = { parameterPath: "serviceType", mapper: { @@ -256,6 +406,36 @@ export const status: msRest.OperationQueryParameter = { } } }; +export const url: msRest.OperationQueryParameter = { + parameterPath: "url", + mapper: { + required: true, + serializedName: "url", + type: { + name: "String" + } + } +}; +export const usdPrice: msRest.OperationQueryParameter = { + parameterPath: "usdPrice", + mapper: { + required: true, + serializedName: "usd_price", + type: { + name: "Number" + } + } +}; +export const useUrl: msRest.OperationQueryParameter = { + parameterPath: "useUrl", + mapper: { + required: true, + serializedName: "use_url", + type: { + name: "String" + } + } +}; export const value: msRest.OperationQueryParameter = { parameterPath: "value", mapper: { diff --git a/src/client/supportHubApi.ts b/src/client/supportHubApi.ts index ec5c3c5..1d38a58 100644 --- a/src/client/supportHubApi.ts +++ b/src/client/supportHubApi.ts @@ -13,10 +13,12 @@ import { SupportHubApiContext } from "./supportHubApiContext"; class SupportHubApi extends SupportHubApiContext { /** * Initializes a new instance of the SupportHubApi class. + * @param entityType Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', + * 'BacklogItem', 'UserBalance', 'User', 'ProjectProductPurchase', 'BoardColumn' * @param [options] The parameter options */ - constructor(options?: Models.SupportHubApiOptions) { - super(options); + constructor(entityType: string, options?: Models.SupportHubApiOptions) { + super(entityType, options); } /** @@ -42,6 +44,68 @@ class SupportHubApi extends SupportHubApiContext { callback) as Promise; } + /** + * @param login + * @param email + * @param password + * @param [options] The optional parameters + * @returns Promise + */ + postRegister(login: string, email: string, password: string, options?: Models.SupportHubApiPostRegisterOptionalParams): Promise; + /** + * @param login + * @param email + * @param password + * @param callback The callback + */ + postRegister(login: string, email: string, password: string, callback: msRest.ServiceCallback): void; + /** + * @param login + * @param email + * @param password + * @param options The optional parameters + * @param callback The callback + */ + postRegister(login: string, email: string, password: string, options: Models.SupportHubApiPostRegisterOptionalParams, callback: msRest.ServiceCallback): void; + postRegister(login: string, email: string, password: string, options?: Models.SupportHubApiPostRegisterOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + login, + email, + password, + options + }, + postRegisterOperationSpec, + callback) as Promise; + } + + /** + * @param confirmationKey + * @param [options] The optional parameters + * @returns Promise + */ + postConfirmEmail(confirmationKey: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param confirmationKey + * @param callback The callback + */ + postConfirmEmail(confirmationKey: string, callback: msRest.ServiceCallback): void; + /** + * @param confirmationKey + * @param options The optional parameters + * @param callback The callback + */ + postConfirmEmail(confirmationKey: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + postConfirmEmail(confirmationKey: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + confirmationKey, + options + }, + postConfirmEmailOperationSpec, + callback) as Promise; + } + /** * Returns github login link * @param [options] The optional parameters @@ -227,6 +291,33 @@ class SupportHubApi extends SupportHubApiContext { callback) as Promise; } + /** + * @param repoGuid Repository Guid + * @param [options] The optional parameters + * @returns Promise + */ + getRepo(repoGuid: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param repoGuid Repository Guid + * @param callback The callback + */ + getRepo(repoGuid: string, callback: msRest.ServiceCallback): void; + /** + * @param repoGuid Repository Guid + * @param options The optional parameters + * @param callback The callback + */ + getRepo(repoGuid: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getRepo(repoGuid: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + repoGuid, + options + }, + getRepoOperationSpec, + callback) as Promise; + } + /** * @param projectGuid Project Guid * @param [options] The optional parameters @@ -424,6 +515,72 @@ class SupportHubApi extends SupportHubApiContext { callback) as Promise; } + /** + * @param apiToken + * @param columnGuid + * @param name + * @param [options] The optional parameters + * @returns Promise + */ + createCard(apiToken: string, columnGuid: string, name: string, options?: Models.SupportHubApiCreateCardOptionalParams): Promise; + /** + * @param apiToken + * @param columnGuid + * @param name + * @param callback The callback + */ + createCard(apiToken: string, columnGuid: string, name: string, callback: msRest.ServiceCallback): void; + /** + * @param apiToken + * @param columnGuid + * @param name + * @param options The optional parameters + * @param callback The callback + */ + createCard(apiToken: string, columnGuid: string, name: string, options: Models.SupportHubApiCreateCardOptionalParams, callback: msRest.ServiceCallback): void; + createCard(apiToken: string, columnGuid: string, name: string, options?: Models.SupportHubApiCreateCardOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + apiToken, + columnGuid, + name, + options + }, + createCardOperationSpec, + callback) as Promise; + } + + /** + * @param apiToken + * @param cardGuid + * @param [options] The optional parameters + * @returns Promise + */ + editCard(apiToken: string, cardGuid: string, options?: Models.SupportHubApiEditCardOptionalParams): Promise; + /** + * @param apiToken + * @param cardGuid + * @param callback The callback + */ + editCard(apiToken: string, cardGuid: string, callback: msRest.ServiceCallback): void; + /** + * @param apiToken + * @param cardGuid + * @param options The optional parameters + * @param callback The callback + */ + editCard(apiToken: string, cardGuid: string, options: Models.SupportHubApiEditCardOptionalParams, callback: msRest.ServiceCallback): void; + editCard(apiToken: string, cardGuid: string, options?: Models.SupportHubApiEditCardOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + apiToken, + cardGuid, + options + }, + editCardOperationSpec, + callback) as Promise; + } + /** * @param cardGuid * @param [options] The optional parameters @@ -453,32 +610,25 @@ class SupportHubApi extends SupportHubApiContext { /** * @param entityGuid - * @param entityType Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', - * 'BacklogItem', 'UserBalance', 'User' * @param [options] The optional parameters * @returns Promise */ - getEntityFundingBalances(entityGuid: string, entityType: Models.EntityType2, options?: msRest.RequestOptionsBase): Promise; + getEntityFundingBalances(entityGuid: string, options?: msRest.RequestOptionsBase): Promise; /** * @param entityGuid - * @param entityType Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', - * 'BacklogItem', 'UserBalance', 'User' * @param callback The callback */ - getEntityFundingBalances(entityGuid: string, entityType: Models.EntityType2, callback: msRest.ServiceCallback): void; + getEntityFundingBalances(entityGuid: string, callback: msRest.ServiceCallback): void; /** * @param entityGuid - * @param entityType Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', - * 'BacklogItem', 'UserBalance', 'User' * @param options The optional parameters * @param callback The callback */ - getEntityFundingBalances(entityGuid: string, entityType: Models.EntityType2, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getEntityFundingBalances(entityGuid: string, entityType: Models.EntityType2, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getEntityFundingBalances(entityGuid: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getEntityFundingBalances(entityGuid: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { entityGuid, - entityType, options }, getEntityFundingBalancesOperationSpec, @@ -581,44 +731,37 @@ class SupportHubApi extends SupportHubApiContext { /** * @param apiToken JWT token * @param entityGuid - * @param entityType Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', - * 'BacklogItem', 'UserBalance', 'User' * @param amount * @param currencyType Possible values include: 'Usd', 'BitCoin', 'Ethereum', 'Erc20Token', * 'Waves', 'WavesToken', 'LiteCoin' * @param [options] The optional parameters * @returns Promise */ - postInvoice(apiToken: string, entityGuid: string, entityType: Models.EntityType3, amount: number, currencyType: Models.CurrencyType4, options?: msRest.RequestOptionsBase): Promise; + postInvoice(apiToken: string, entityGuid: string, amount: number, currencyType: Models.CurrencyType5, options?: msRest.RequestOptionsBase): Promise; /** * @param apiToken JWT token * @param entityGuid - * @param entityType Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', - * 'BacklogItem', 'UserBalance', 'User' * @param amount * @param currencyType Possible values include: 'Usd', 'BitCoin', 'Ethereum', 'Erc20Token', * 'Waves', 'WavesToken', 'LiteCoin' * @param callback The callback */ - postInvoice(apiToken: string, entityGuid: string, entityType: Models.EntityType3, amount: number, currencyType: Models.CurrencyType4, callback: msRest.ServiceCallback): void; + postInvoice(apiToken: string, entityGuid: string, amount: number, currencyType: Models.CurrencyType5, callback: msRest.ServiceCallback): void; /** * @param apiToken JWT token * @param entityGuid - * @param entityType Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', - * 'BacklogItem', 'UserBalance', 'User' * @param amount * @param currencyType Possible values include: 'Usd', 'BitCoin', 'Ethereum', 'Erc20Token', * 'Waves', 'WavesToken', 'LiteCoin' * @param options The optional parameters * @param callback The callback */ - postInvoice(apiToken: string, entityGuid: string, entityType: Models.EntityType3, amount: number, currencyType: Models.CurrencyType4, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - postInvoice(apiToken: string, entityGuid: string, entityType: Models.EntityType3, amount: number, currencyType: Models.CurrencyType4, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + postInvoice(apiToken: string, entityGuid: string, amount: number, currencyType: Models.CurrencyType5, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + postInvoice(apiToken: string, entityGuid: string, amount: number, currencyType: Models.CurrencyType5, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { apiToken, entityGuid, - entityType, amount, currencyType, options @@ -929,6 +1072,37 @@ class SupportHubApi extends SupportHubApiContext { callback) as Promise; } + /** + * @param apiToken + * @param projectGuid + * @param [options] The optional parameters + * @returns Promise + */ + getMyLibraryProjectStatus(apiToken: string, projectGuid: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param apiToken + * @param projectGuid + * @param callback The callback + */ + getMyLibraryProjectStatus(apiToken: string, projectGuid: string, callback: msRest.ServiceCallback): void; + /** + * @param apiToken + * @param projectGuid + * @param options The optional parameters + * @param callback The callback + */ + getMyLibraryProjectStatus(apiToken: string, projectGuid: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getMyLibraryProjectStatus(apiToken: string, projectGuid: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + apiToken, + projectGuid, + options + }, + getMyLibraryProjectStatusOperationSpec, + callback) as Promise; + } + /** * @param apiToken JWT token * @param [options] The optional parameters @@ -1036,32 +1210,28 @@ class SupportHubApi extends SupportHubApiContext { /** * @param apiToken JWT token * @param entityGuid - * @param entityType Possible values include: 'Project', 'Board', 'BoardColumn', 'Card' * @param [options] The optional parameters * @returns Promise */ - getMyEntityPermissions(apiToken: string, entityGuid: string, entityType: Models.EntityType4, options?: msRest.RequestOptionsBase): Promise; + getMyEntityPermissions(apiToken: string, entityGuid: string, options?: msRest.RequestOptionsBase): Promise; /** * @param apiToken JWT token * @param entityGuid - * @param entityType Possible values include: 'Project', 'Board', 'BoardColumn', 'Card' * @param callback The callback */ - getMyEntityPermissions(apiToken: string, entityGuid: string, entityType: Models.EntityType4, callback: msRest.ServiceCallback): void; + getMyEntityPermissions(apiToken: string, entityGuid: string, callback: msRest.ServiceCallback): void; /** * @param apiToken JWT token * @param entityGuid - * @param entityType Possible values include: 'Project', 'Board', 'BoardColumn', 'Card' * @param options The optional parameters * @param callback The callback */ - getMyEntityPermissions(apiToken: string, entityGuid: string, entityType: Models.EntityType4, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getMyEntityPermissions(apiToken: string, entityGuid: string, entityType: Models.EntityType4, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getMyEntityPermissions(apiToken: string, entityGuid: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getMyEntityPermissions(apiToken: string, entityGuid: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { apiToken, entityGuid, - entityType, options }, getMyEntityPermissionsOperationSpec, @@ -1113,6 +1283,184 @@ class SupportHubApi extends SupportHubApiContext { getRandomProjectsOperationSpec, callback) as Promise; } + + /** + * @param projectGuid + * @param [options] The optional parameters + * @returns Promise + */ + getProjectProducts(projectGuid: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param projectGuid + * @param callback The callback + */ + getProjectProducts(projectGuid: string, callback: msRest.ServiceCallback): void; + /** + * @param projectGuid + * @param options The optional parameters + * @param callback The callback + */ + getProjectProducts(projectGuid: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getProjectProducts(projectGuid: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + projectGuid, + options + }, + getProjectProductsOperationSpec, + callback) as Promise; + } + + /** + * @param apiToken JWT token + * @param projectGuid + * @param name + * @param description + * @param usdPrice + * @param url + * @param useUrl + * @param [options] The optional parameters + * @returns Promise + */ + postProjectProduct(apiToken: string, projectGuid: string, name: string, description: string, usdPrice: number, url: string, useUrl: string, options?: Models.SupportHubApiPostProjectProductOptionalParams): Promise; + /** + * @param apiToken JWT token + * @param projectGuid + * @param name + * @param description + * @param usdPrice + * @param url + * @param useUrl + * @param callback The callback + */ + postProjectProduct(apiToken: string, projectGuid: string, name: string, description: string, usdPrice: number, url: string, useUrl: string, callback: msRest.ServiceCallback): void; + /** + * @param apiToken JWT token + * @param projectGuid + * @param name + * @param description + * @param usdPrice + * @param url + * @param useUrl + * @param options The optional parameters + * @param callback The callback + */ + postProjectProduct(apiToken: string, projectGuid: string, name: string, description: string, usdPrice: number, url: string, useUrl: string, options: Models.SupportHubApiPostProjectProductOptionalParams, callback: msRest.ServiceCallback): void; + postProjectProduct(apiToken: string, projectGuid: string, name: string, description: string, usdPrice: number, url: string, useUrl: string, options?: Models.SupportHubApiPostProjectProductOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + apiToken, + projectGuid, + name, + description, + usdPrice, + url, + useUrl, + options + }, + postProjectProductOperationSpec, + callback) as Promise; + } + + /** + * @param apiToken JWT token + * @param productGuid + * @param [options] The optional parameters + * @returns Promise + */ + deleteProjectProduct(apiToken: string, productGuid: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param apiToken JWT token + * @param productGuid + * @param callback The callback + */ + deleteProjectProduct(apiToken: string, productGuid: string, callback: msRest.ServiceCallback): void; + /** + * @param apiToken JWT token + * @param productGuid + * @param options The optional parameters + * @param callback The callback + */ + deleteProjectProduct(apiToken: string, productGuid: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteProjectProduct(apiToken: string, productGuid: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + apiToken, + productGuid, + options + }, + deleteProjectProductOperationSpec, + callback) as Promise; + } + + /** + * @param apiToken JWT token + * @param [options] The optional parameters + * @returns Promise + */ + getMyWithdrawalRequests(apiToken: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param apiToken JWT token + * @param callback The callback + */ + getMyWithdrawalRequests(apiToken: string, callback: msRest.ServiceCallback): void; + /** + * @param apiToken JWT token + * @param options The optional parameters + * @param callback The callback + */ + getMyWithdrawalRequests(apiToken: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getMyWithdrawalRequests(apiToken: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + apiToken, + options + }, + getMyWithdrawalRequestsOperationSpec, + callback) as Promise; + } + + /** + * @param apiToken JWT token + * @param amount + * @param address + * @param currencyType Possible values include: 'Usd', 'BitCoin', 'Ethereum', 'Erc20Token', + * 'Waves', 'WavesToken', 'LiteCoin' + * @param [options] The optional parameters + * @returns Promise + */ + postWithdrawalRequest(apiToken: string, amount: number, address: string, currencyType: Models.CurrencyType6, options?: msRest.RequestOptionsBase): Promise; + /** + * @param apiToken JWT token + * @param amount + * @param address + * @param currencyType Possible values include: 'Usd', 'BitCoin', 'Ethereum', 'Erc20Token', + * 'Waves', 'WavesToken', 'LiteCoin' + * @param callback The callback + */ + postWithdrawalRequest(apiToken: string, amount: number, address: string, currencyType: Models.CurrencyType6, callback: msRest.ServiceCallback): void; + /** + * @param apiToken JWT token + * @param amount + * @param address + * @param currencyType Possible values include: 'Usd', 'BitCoin', 'Ethereum', 'Erc20Token', + * 'Waves', 'WavesToken', 'LiteCoin' + * @param options The optional parameters + * @param callback The callback + */ + postWithdrawalRequest(apiToken: string, amount: number, address: string, currencyType: Models.CurrencyType6, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + postWithdrawalRequest(apiToken: string, amount: number, address: string, currencyType: Models.CurrencyType6, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + apiToken, + amount, + address, + currencyType, + options + }, + postWithdrawalRequestOperationSpec, + callback) as Promise; + } } // Operation Specifications @@ -1121,8 +1469,8 @@ const getLoginOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "api/v1/login", queryParameters: [ - Parameters.email, - Parameters.password + Parameters.email0, + Parameters.password0 ], responses: { 200: { @@ -1133,6 +1481,39 @@ const getLoginOperationSpec: msRest.OperationSpec = { serializer }; +const postRegisterOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "api/v1/register", + queryParameters: [ + Parameters.login, + Parameters.email1, + Parameters.password1, + Parameters.referralKey + ], + responses: { + 200: { + bodyMapper: Mappers.PostRegisterOKResponse + }, + default: {} + }, + serializer +}; + +const postConfirmEmailOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "api/v1/register/confirm_email", + queryParameters: [ + Parameters.confirmationKey + ], + responses: { + 200: { + bodyMapper: Mappers.PostConfirmEmailOKResponse + }, + default: {} + }, + serializer +}; + const getGitHubLoginLinkOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "api/v1/auth/github/login_link/get", @@ -1234,6 +1615,21 @@ const postImportRepositoryOperationSpec: msRest.OperationSpec = { serializer }; +const getRepoOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "api/v1/repository/get", + queryParameters: [ + Parameters.repoGuid + ], + responses: { + 200: { + bodyMapper: Mappers.GetRepoOKResponse + }, + default: {} + }, + serializer +}; + const getProjectOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "api/v1/project/get", @@ -1255,7 +1651,7 @@ const editProjectOperationSpec: msRest.OperationSpec = { queryParameters: [ Parameters.apiToken, Parameters.projectGuid, - Parameters.description + Parameters.description0 ], responses: { 200: { @@ -1315,7 +1711,7 @@ const getColumnCardsOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "api/v1/board_column/cards/get", queryParameters: [ - Parameters.columnGuid + Parameters.columnGuid0 ], responses: { 200: { @@ -1342,6 +1738,45 @@ const getProjectByAliasOperationSpec: msRest.OperationSpec = { serializer }; +const createCardOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "api/v1/card/create", + queryParameters: [ + Parameters.apiToken, + Parameters.columnGuid0, + Parameters.name0, + Parameters.description0, + Parameters.columnOrder + ], + responses: { + 201: { + bodyMapper: Mappers.CreateCardCreatedResponse + }, + default: {} + }, + serializer +}; + +const editCardOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "api/v1/card/edit", + queryParameters: [ + Parameters.apiToken, + Parameters.cardGuid, + Parameters.name1, + Parameters.description0, + Parameters.columnOrder, + Parameters.columnGuid1 + ], + responses: { + 200: { + bodyMapper: Mappers.EditCardOKResponse + }, + default: {} + }, + serializer +}; + const getCardWorkOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "api/v1/card/work/get", @@ -1598,6 +2033,22 @@ const removeProjectFromMyLibraryOperationSpec: msRest.OperationSpec = { serializer }; +const getMyLibraryProjectStatusOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "api/v1/me/library/project/status/get", + queryParameters: [ + Parameters.apiToken, + Parameters.projectGuid + ], + responses: { + 200: { + bodyMapper: Mappers.GetMyLibraryProjectStatusOKResponse + }, + default: {} + }, + serializer +}; + const getMeOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "api/v1/me/get", @@ -1696,6 +2147,92 @@ const getRandomProjectsOperationSpec: msRest.OperationSpec = { serializer }; +const getProjectProductsOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "api/v1/project/products/get", + queryParameters: [ + Parameters.projectGuid + ], + responses: { + 200: { + bodyMapper: Mappers.GetProjectProductsOKResponse + }, + default: {} + }, + serializer +}; + +const postProjectProductOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "api/v1/project/product/new", + queryParameters: [ + Parameters.apiToken, + Parameters.projectGuid, + Parameters.name0, + Parameters.description1, + Parameters.usdPrice, + Parameters.url, + Parameters.useUrl, + Parameters.durationHours + ], + responses: { + 201: { + bodyMapper: Mappers.PostProjectProductCreatedResponse + }, + default: {} + }, + serializer +}; + +const deleteProjectProductOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "api/v1/project/product/delete", + queryParameters: [ + Parameters.apiToken, + Parameters.productGuid + ], + responses: { + 200: { + bodyMapper: Mappers.DeleteProjectProductOKResponse + }, + default: {} + }, + serializer +}; + +const getMyWithdrawalRequestsOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "api/v1/me/withdrawals/get", + queryParameters: [ + Parameters.apiToken + ], + responses: { + 200: { + bodyMapper: Mappers.GetMyWithdrawalRequestsOKResponse + }, + default: {} + }, + serializer +}; + +const postWithdrawalRequestOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "api/v1/me/withdrawal/new", + queryParameters: [ + Parameters.apiToken, + Parameters.amount, + Parameters.address, + Parameters.currencyType + ], + responses: { + 201: { + bodyMapper: Mappers.PostWithdrawalRequestCreatedResponse + }, + default: {} + }, + serializer +}; + export { SupportHubApi, SupportHubApiContext, diff --git a/src/client/supportHubApiContext.ts b/src/client/supportHubApiContext.ts index 6de629e..b4e48dd 100644 --- a/src/client/supportHubApiContext.ts +++ b/src/client/supportHubApiContext.ts @@ -11,12 +11,20 @@ const packageName = ""; const packageVersion = ""; export class SupportHubApiContext extends msRest.ServiceClient { + entityType: string; + currencyType?: Models.CurrencyType4; /** * Initializes a new instance of the SupportHubApiContext class. + * @param entityType Possible values include: 'ProjectCategory', 'Project', 'Board', 'Card', + * 'BacklogItem', 'UserBalance', 'User', 'ProjectProductPurchase', 'BoardColumn' * @param [options] The parameter options */ - constructor(options?: Models.SupportHubApiOptions) { + constructor(entityType: string, options?: Models.SupportHubApiOptions) { + if (entityType == undefined) { + throw new Error("'entityType' cannot be null."); + } + if (!options) { options = {}; } @@ -28,7 +36,11 @@ export class SupportHubApiContext extends msRest.ServiceClient { super(undefined, options); - this.baseUri = options.baseUri || this.baseUri || "http://api.supporthub.com/api/v1"; + this.baseUri = options.baseUri || this.baseUri || "http://api.gitcom.com/api/v1"; this.requestContentType = "application/json; charset=utf-8"; + this.entityType = entityType; + if (options.currencyType !== null && options.currencyType !== undefined) { + this.currencyType = options.currencyType; + } } } diff --git a/src/components/check/auth_check/AuthCheck.tsx b/src/components/check/auth_check/AuthCheck.tsx new file mode 100644 index 0000000..602beb2 --- /dev/null +++ b/src/components/check/auth_check/AuthCheck.tsx @@ -0,0 +1,21 @@ +import React from "react"; + +interface IProps { +} + +interface IState { +} + +class AuthCheck extends React.Component { + isAuthorized() { + return window.App.isAuthorized(); + } + + render() { + return
+ {this.isAuthorized() ? this.props.children : null} +
; + } +} + +export default AuthCheck; diff --git a/src/components/check/permission_check/single/PermissionCheck.tsx b/src/components/check/permission_check/single/PermissionCheck.tsx new file mode 100644 index 0000000..15c9e7f --- /dev/null +++ b/src/components/check/permission_check/single/PermissionCheck.tsx @@ -0,0 +1,79 @@ +import React from "react"; +import {EntityType} from "../../../../client/models"; +import {Icon} from "antd"; +import {retryRequest} from "../../../../classes/utils/http/retryRequest"; + +interface IProps { + entityGuid: string, + entityType: EntityType, + requiredPermissions: string[], +} + +interface IState { + isLoading: boolean, + gotPermissions: boolean +} + +class PermissionCheck extends React.Component { + constructor(props: IProps) { + super(props); + this.state = { + isLoading: true, + gotPermissions: false + } + } + + componentDidMount(): void { + setTimeout(() => { + retryRequest(() => { + this.getPermissions(); + }, () => this.state.isLoading, false); + }, Math.floor(Math.random() * 1000)); + } + + getPermissions() { + window.App.apiClient.entityType = this.props.entityType; + window.App.apiClient.getMyEntityPermissions(window.App.apiToken, this.props.entityGuid) + .then((result) => + this.processGotPermissions(result._response)) + .catch(() => this.processApiError()); + } + + processApiError() { + this.setState({ + isLoading: false, + gotPermissions: false + }); + } + + processGotPermissions(response: any) { + let data = JSON.parse(response.bodyAsText).data; + + let gotPermissions = true; + + this.props.requiredPermissions.forEach((permission: string) => { + if (!data.permissions.includes(permission)) { + gotPermissions = false; + } + }); + + this.setState({ + isLoading: false, + gotPermissions: gotPermissions + }); + } + + render() { + if (this.state.isLoading) { + return ; + } + if (!this.state.gotPermissions) { + return
; + } + return
+ {this.props.children} +
; + } +} + +export default PermissionCheck; diff --git a/src/components/entity/budget/entity/EntityBudgetContent.tsx b/src/components/entity/budget/entity/EntityBudgetContent.tsx index 25a240a..1f0431f 100644 --- a/src/components/entity/budget/entity/EntityBudgetContent.tsx +++ b/src/components/entity/budget/entity/EntityBudgetContent.tsx @@ -31,7 +31,8 @@ class EntityBudgetContent extends React.Component { } getData(): void { - window.App.apiClient.getEntityFundingBalances(this.props.entityGuid, this.props.entityType) + window.App.apiClient.entityType = this.props.entityType; + window.App.apiClient.getEntityFundingBalances(this.props.entityGuid) .then((result) => this.processResponse(result._response)) .catch((error) => handleApiError(error.response)); diff --git a/src/components/entity/card/action/create/CreateCard.tsx b/src/components/entity/card/action/create/CreateCard.tsx new file mode 100644 index 0000000..c9c019d --- /dev/null +++ b/src/components/entity/card/action/create/CreateCard.tsx @@ -0,0 +1,107 @@ +import React from "react"; +import {Button, Input, Modal, notification, Row} from "antd"; +import {CardModel, ColumnModel} from "../../../../../client/bindings"; +import {handleApiError} from "../../../../../classes/notification/errorHandler/errorHandler"; + +const { TextArea } = Input; + +interface IProps { + column: ColumnModel +} + +interface IState { + showModal: boolean, + newCard: CardModel, + + requestSent: boolean +} + +class CreateCard extends React.Component { + constructor(props: IProps) { + super(props); + this.state = { + showModal: false, + newCard: new CardModel(), + + requestSent: false + } + } + + openModal() { + this.setState({ + showModal: true + }); + } + + updateCard(field: string, value: any) { + let updatedCard: any = this.state.newCard; + updatedCard[field] = value; + this.setState({ + newCard: updatedCard + }); + } + + createCard() { + window.App.apiClient.createCard(window.App.apiToken, this.props.column.guid!, this.state.newCard.name!, { + description: this.state.newCard.description! + }) + .then((result) => + this.processCardCreated(result._response)) + .catch((error) => handleApiError(error.response)); + } + + processCardCreated(response: any) { + notification['success']({ + message: 'Card was created!', + description: '' + }); + + setTimeout(() => { + window.location.reload(); + }, 1000); + } + + render() { + return
+ Create new card} + visible={this.state.showModal} + width={window.innerWidth < 1000 ? "90%" : "30%"} + onCancel={() => { + this.setState({showModal: false}) + }} + footer={null} + > + + Name: + { + this.updateCard("name", e.target.value); + }} placeholder="Add new amazing feature" /> + + Description: +