Skip to content

Commit 043be07

Browse files
committed
feat: replace refs of Classy with GoFundMe Pro
1 parent bf65399 commit 043be07

18 files changed

Lines changed: 93 additions & 93 deletions

File tree

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Classy
3+
Copyright (c) 2024 GoFundMe Pro
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Custom Progress Bar Sample App
22

3-
This is a sample application that demonstrates how to create a custom progress bar with your Classy data. It should be used purely as instructional material rather than a production-ready application.
3+
This is a sample application that demonstrates how to create a custom progress bar with your GoFundMe Pro data. It should be used purely as instructional material rather than a production-ready application.
44

5-
Please refer to Classy's [developer documentation](https://developers.classy.org/overview/welcome) for more information about how to work with our product.
5+
Please refer to GoFundMe Pro's [developer documentation](https://developers.classy.org/overview/welcome) for more information about how to work with our product.
66

77
This application shell makes use of a
8-
[Node backend layer](https://nodejs.org/en) to handle requests between the application and Classy's API as well as a [React frontend](https://react.dev/) to create a Client for the data retrieved from the customer's Classy account.
8+
[Node backend layer](https://nodejs.org/en) to handle requests between the application and GoFundMe Pro's API as well as a [React frontend](https://react.dev/) to create a Client for the data retrieved from the customer's GoFundMe Pro account.
99

1010
You can find the backend layer in the `/backend` folder (and setup instructions [here](/backend/README.md)) and the frontend part of the application in the `/frontend` folder (and setup instructions [here](/frontend/README.md)).
1111

backend/.env.template

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Environment Configuration
2-
NODE_ENV="development" # Options: 'development', 'production'
3-
PORT="8080" # The port your server will listen on
4-
HOST="localhost" # Hostname for the server
5-
CLASSY_API_BASE_URL="https://api.classy.org" # Base URL for the Classy API
6-
CLASSY_CLIENT_ID="" # Your Classy app client ID
7-
CLASSY_CLIENT_SECRET="" # Your Classy app client Secret
2+
NODE_ENV="development" # Options: 'development', 'production'
3+
PORT="8080" # The port your server will listen on
4+
HOST="localhost" # Hostname for the server
5+
GO_FUND_ME_PRO_API_BASE_URL="https://api.classy.org" # Base URL for the GoFundMe Pro API
6+
GO_FUND_ME_PRO_CLIENT_ID="" # Your GoFundMe Pro app client ID
7+
GO_FUND_ME_PRO_CLIENT_SECRET="" # Your GoFundMe Pro app client Secret

backend/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Classy Progress Bar Sample App
1+
# GoFundMe Pro Progress Bar Sample App
22

3-
Sample NodeJS/Express backend to provide a REST API to query the fundraising progress of a Classy campaign.
3+
Sample NodeJS/Express backend to provide a REST API to query the fundraising progress of a GoFundMe Pro campaign.
44

5-
This project is meant to be a simple example of how to connect to the Classy API, consume information about campaigns and expose it through a REST API. It is not meant to be a full-fledged application, nor to be used in production as-is.
5+
This project is meant to be a simple example of how to connect to the GoFundMe Pro API, consume information about campaigns and expose it through a REST API. It is not meant to be a full-fledged application, nor to be used in production as-is.
66

77
## Getting Started
88

@@ -14,13 +14,13 @@ This project is meant to be a simple example of how to connect to the Classy API
1414

1515
1. Clone the repository
1616
2. Install dependencies: `npm install`
17-
3. Copy the `.env.template` file to `.env` and update environment variables as needed. In particular, ensure that `CLASSY_CLIENT_ID` and `CLASSY_CLIENT_SECRET` are set. You can obtain these by creating a new application in the [Classy Developer Portal](https://developer.classy.org/).
17+
3. Copy the `.env.template` file to `.env` and update environment variables as needed. In particular, ensure that `GO_FUND_ME_PRO_CLIENT_ID` and `GO_FUND_ME_PRO_CLIENT_SECRET` are set. You can obtain these by creating a new application in the [GoFundMe Pro Developer Portal](https://developers.classy.org/).
1818
4. Start the development server: `npm run dev`
1919

2020
## Project description
2121

22-
This project is meant as an example of how to consume the Classy APIs.
23-
It provides a simple REST API with a single endpoint `/campaigns/:id` that returns the fundraising progress of a Classy campaign.
22+
This project is meant as an example of how to consume the GoFundMe Pro APIs.
23+
It provides a simple REST API with a single endpoint `/campaigns/:id` that returns the fundraising progress of a GoFundMe Pro campaign.
2424

2525
This project can be consumed directly, via an API platform like [Postman](https://www.postman.com/) or through our sample [frontend](../frontend/README.md) project.
2626

@@ -29,8 +29,8 @@ This project can be consumed directly, via an API platform like [Postman](https:
2929
This project uses [Express](https://expressjs.com/) to create a simple REST API with two routes defined in the `src/server.ts` file:
3030

3131
- `GET /health-check`: A simple health check endpoint that returns a 200 status code if the server is running.
32-
- `GET /campaigns/:campaignId/progress`: An endpoint that returns the fundraising progress of a Classy campaign.
32+
- `GET /campaigns/:campaignId/progress`: An endpoint that returns the fundraising progress of a GoFundMe Pro campaign.
3333

3434
Each route group is handled by a separate router file inside the `src/api` folder.
3535

36-
Within the `src/common/utils/classyAuth.ts` file, you will find the logic to authenticate with the Classy API using the client id and secret.
36+
Within the `src/common/utils/auth.ts` file, you will find the logic to authenticate with the GoFundMe Pro API using the client id and secret.

backend/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "classy-progress-bar-backend",
2+
"name": "go-fund-me-pro-progress-bar-backend",
33
"version": "1.0.0",
4-
"description": "An express backend for the Classy progress bar sample app",
4+
"description": "An express backend for the GoFundMe Pro progress bar sample app",
55
"main": "index.ts",
66
"private": true,
77
"scripts": {

backend/src/api/campaign/__tests__/campaignRouter.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ import request from 'supertest';
66
import { env } from '@/common/utils/envConfig';
77
import { app } from '@/server';
88

9-
import { ClassyCampaignOverview } from '../campaignModel';
9+
import { GoFundMeProCampaignOverview } from '../campaignModel';
1010

1111
describe('Campaign API endpoints', () => {
1212
describe('GET /campaigns/:campaignId/progress endpoint', () => {
1313
const campaignId = 1234;
1414

1515
it('success', async () => {
1616
const server = setupServer(
17-
http.post(`${env.CLASSY_API_BASE_URL}/oauth2/auth`, () => {
17+
http.post(`${env.GO_FUND_ME_PRO_API_BASE_URL}/oauth2/auth`, () => {
1818
return HttpResponse.json({
1919
access_token: '123token',
2020
});
2121
}),
22-
http.get(`${env.CLASSY_API_BASE_URL}/2.0/campaigns/${campaignId}/overview`, () => {
22+
http.get(`${env.GO_FUND_ME_PRO_API_BASE_URL}/2.0/campaigns/${campaignId}/overview`, () => {
2323
return HttpResponse.json({
2424
gross_amount: 120.4,
2525
});
@@ -29,7 +29,7 @@ describe('Campaign API endpoints', () => {
2929
server.listen();
3030

3131
const response = await request(app).get(`/campaigns/${campaignId}/progress`);
32-
const result: { success: true; payload: ClassyCampaignOverview } = response.body;
32+
const result: { success: true; payload: GoFundMeProCampaignOverview } = response.body;
3333

3434
expect(response.statusCode).toEqual(StatusCodes.OK);
3535
expect(result.success).toEqual(true);
@@ -39,11 +39,11 @@ describe('Campaign API endpoints', () => {
3939
server.close();
4040
});
4141

42-
it('Classy auth fails', async () => {
42+
it('GoFundMe Pro auth fails', async () => {
4343
const server = setupServer(
44-
http.post(`${env.CLASSY_API_BASE_URL}/oauth2/auth`, () => {
44+
http.post(`${env.GO_FUND_ME_PRO_API_BASE_URL}/oauth2/auth`, () => {
4545
return HttpResponse.json({
46-
error: 'Failed to connect to Classy',
46+
error: 'Failed to connect to GoFundMe Pro',
4747
});
4848
})
4949
);
@@ -56,19 +56,19 @@ describe('Campaign API endpoints', () => {
5656
expect(response.statusCode).toEqual(StatusCodes.INTERNAL_SERVER_ERROR);
5757
expect(result.success).toEqual(false);
5858
expect(result.statusCode).toEqual(StatusCodes.INTERNAL_SERVER_ERROR);
59-
expect(result.message).toEqual('The authentication with Classy failed.');
59+
expect(result.message).toEqual('The authentication with GoFundMe Pro failed.');
6060

6161
server.close();
6262
});
6363

6464
it('Class campaign overview fetch fails', async () => {
6565
const server = setupServer(
66-
http.post(`${env.CLASSY_API_BASE_URL}/oauth2/auth`, () => {
66+
http.post(`${env.GO_FUND_ME_PRO_API_BASE_URL}/oauth2/auth`, () => {
6767
return HttpResponse.json({
6868
access_token: '123token',
6969
});
7070
}),
71-
http.get(`${env.CLASSY_API_BASE_URL}/2.0/campaigns/${campaignId}/overview`, () => {
71+
http.get(`${env.GO_FUND_ME_PRO_API_BASE_URL}/2.0/campaigns/${campaignId}/overview`, () => {
7272
return HttpResponse.json({
7373
error: 'Failed to retrieve aggregates',
7474
});

backend/src/api/campaign/campaignModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export type ClassyCampaignOverview = {
1+
export type GoFundMeProCampaignOverview = {
22
donation_net_amount: number;
33
donations_amount: string;
44
donors_count: number;

backend/src/api/campaign/campaignRouter.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import express, { Request, Response, Router } from 'express';
22
import { StatusCodes } from 'http-status-codes';
33

4-
import { ClassyErrorResponse } from '@/common/types/auth';
5-
import { auth } from '@/common/utils/classyAuth';
4+
import { GoFundMeProErrorResponse } from '@/common/types/auth';
5+
import { auth } from '@/common/utils/auth';
66
import { env } from '@/common/utils/envConfig';
77

8-
import { ClassyCampaignOverview } from './campaignModel';
8+
import { GoFundMeProCampaignOverview } from './campaignModel';
99

1010
const validateOverviewResponse = async (campaignId: number, response: globalThis.Response) => {
1111
const payload = await response.json();
1212

13-
if ((payload as ClassyErrorResponse)?.error) {
13+
if ((payload as GoFundMeProErrorResponse)?.error) {
1414
throw new Error(`Failed to retrieve aggregates for campaign ${campaignId}`);
1515
}
1616

17-
return payload as ClassyCampaignOverview;
17+
return payload as GoFundMeProCampaignOverview;
1818
};
1919

2020
export const campaignRouter: Router = (() => {
@@ -27,12 +27,12 @@ export const campaignRouter: Router = (() => {
2727
try {
2828
const campaignId = parseInt(req.params.campaignId as string, 10);
2929

30-
// Get the auth token for the Classy app.
30+
// Get the auth token for the GoFundMe Pro app.
3131
// This token should be cached in a fully fledged application, reusing it for subsequent requests while it's valid.
3232
const authResponse = await auth();
3333

3434
// Get the aggregates for the campaign.
35-
const overviewResponse = await fetch(`${env.CLASSY_API_BASE_URL}/2.0/campaigns/${campaignId}/overview`, {
35+
const overviewResponse = await fetch(`${env.GO_FUND_ME_PRO_API_BASE_URL}/2.0/campaigns/${campaignId}/overview`, {
3636
method: 'GET',
3737
headers: {
3838
'Content-Type': 'application/json',

backend/src/common/types/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
export type ClassyErrorResponse = {
1+
export type GoFundMeProErrorResponse = {
22
error: string | Record<string, string[]>;
33
};
44

5-
export type ClassyAuthResponse = {
5+
export type GoFundMeProAuthResponse = {
66
access_token: string;
77
expires_in: number;
88
token_type: string;

0 commit comments

Comments
 (0)