GolfGlobe365 GAMP
SDKs

JavaScript/Node.js SDK

JavaScript/Node.js SDK

Official GG365 SDK for JavaScript and Node.js applications.


๐Ÿ“ฆ Installation

TerminalCode
npm install @gg365/sdk # or yarn add @gg365/sdk # or pnpm add @gg365/sdk

๐Ÿš€ Quick Start

REST API

JavascriptCode
import { GG365Client } from '@gg365/sdk'; const client = new GG365Client({ apiKey: process.env.GG365_API_KEY, environment: 'production' // or 'staging', 'development' }); // Search courses const courses = await client.courses.search({ country: 'ES', region: 'costa-del-sol', limit: 10 }); // Check availability const availability = await client.teetimes.checkAvailability({ courseId: courses[0].id, date: '2025-12-15', players: 2 }); // Create booking const booking = await client.bookings.create({ courseId: courses[0].id, teeTimeId: availability[0].id, players: [ { type: 'lead', firstName: 'John', lastName: 'Smith', email: '[email protected]' } ] }); console.log('Booking created:', booking.reference);

โ›“๏ธ Blockchain API

JavascriptCode
import { GG365BlockchainClient } from '@gg365/sdk'; import { ethers } from 'ethers'; const wallet = new ethers.Wallet(process.env.PRIVATE_KEY); const blockchain = new GG365BlockchainClient({ network: 'camino', wallet: wallet }); // Create blockchain booking const booking = await blockchain.bookings.create({ courseId: 'gg365-course-12345', teeTimeId: 'gg365-teetime-67890', players: 2, payment: { method: 'crypto', token: 'CAM', amount: 185 }, blockchain: { smartContract: true, nftTicket: true } }); console.log('Smart Contract:', booking.blockchain.smartContract.contractAddress); console.log('NFT Token ID:', booking.blockchain.nftTicket.tokenId);

๐Ÿ“š API Reference

Client Configuration

JavascriptCode
const client = new GG365Client({ apiKey: string, // Required: Your API key environment: string, // Optional: 'production' | 'staging' | 'development' baseUrl: string, // Optional: Custom API base URL timeout: number, // Optional: Request timeout (ms) retries: number, // Optional: Number of retries logger: Logger // Optional: Custom logger });

Courses

JavascriptCode
// Search courses await client.courses.search(params); // Get course details await client.courses.get(courseId); // Get course by booking code await client.courses.getByCode(bookingCode);

Tee Times

JavascriptCode
// Check availability await client.teetimes.checkAvailability(params); // Get tee time details await client.teetimes.get(teeTimeId);

Bookings

JavascriptCode
// Create booking await client.bookings.create(data); // Get booking await client.bookings.get(bookingId); // List bookings await client.bookings.list(params); // Cancel booking await client.bookings.cancel(bookingId);

๐Ÿ”ง Advanced Usage

Error Handling

JavascriptCode
import { GG365Error, RateLimitError, ValidationError } from '@gg365/sdk'; try { const booking = await client.bookings.create(data); } catch (error) { if (error instanceof RateLimitError) { console.log('Rate limit exceeded, retry after:', error.retryAfter); } else if (error instanceof ValidationError) { console.log('Validation errors:', error.errors); } else if (error instanceof GG365Error) { console.log('API error:', error.message, error.code); } }

Webhooks

JavascriptCode
import { GG365WebhookHandler } from '@gg365/sdk'; const webhookHandler = new GG365WebhookHandler({ secret: process.env.WEBHOOK_SECRET }); // Express.js example app.post('/webhooks/gg365', async (req, res) => { try { const event = webhookHandler.verify(req.body, req.headers); switch (event.type) { case 'booking.confirmed': console.log('Booking confirmed:', event.data); break; case 'booking.cancelled': console.log('Booking cancelled:', event.data); break; } res.status(200).send('OK'); } catch (error) { res.status(400).send('Invalid signature'); } });

๐Ÿ“– Examples

TypeScript Support

TypeScriptCode
import { GG365Client, Course, Booking } from '@gg365/sdk'; const client = new GG365Client({ apiKey: process.env.GG365_API_KEY! }); const courses: Course[] = await client.courses.search({ country: 'ES' }); const booking: Booking = await client.bookings.create({ courseId: courses[0].id, teeTimeId: 'gg365-teetime-67890', players: [...] });

React Integration

ReactCode
import { useGG365 } from '@gg365/sdk/react'; function CourseSearch() { const { courses, loading, error } = useGG365({ method: 'courses.search', params: { country: 'ES' } }); if (loading) return <div>Loading...</div>; if (error) return <div>Error: {error.message}</div>; return ( <div> {courses.map(course => ( <div key={course.id}>{course.name}</div> ))} </div> ); }


Status: ๐Ÿšง SDK in development - Coming Q1 2026!

For immediate assistance, contact: [email protected]

Last modified on