# oddin-gg/gosdk architecture

> Architecture diagram of the GitHub repository oddin-gg/gosdk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oddin-gg/gosdk
- Repository: https://github.com/oddin-gg/gosdk

## Overview

Oddin.gg’s Go SDK combines a REST catalog API with a streaming odds-feed client. The main consumer workflow is to configure and construct a client, subscribe (which connects to AMQP if needed), decode feed deliveries into typed messages, and consume them; subscriptions can be drained before shutdown. Separate capabilities expose catalog lookups and caches, replay controls, producer status, and feed recovery. The excerpts show several internal calls, but not the full client/session wiring, so some relationships are omitted rather than inferred.

Main entry points: [`client.go`](https://github.com/oddin-gg/gosdk/blob/main/client.go) (Client lifecycle), [`internal/api/client.go`](https://github.com/oddin-gg/gosdk/blob/main/internal/api/client.go) (REST API client), [`session.go`](https://github.com/oddin-gg/gosdk/blob/main/session.go) (Session orchestration), [`internal/feed/channelConsumer.go`](https://github.com/oddin-gg/gosdk/blob/main/internal/feed/channelConsumer.go) (Delivery consumer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lifecycle["Client lifecycle"]
  node_client["Client lifecycle<br/>[client.go]"]
  node_config["Configuration<br/>[config.go]"]
  node_subscription["Subscription<br/>[subscription.go]"]
end

subgraph group_stream["Streaming feed"]
  node_session["Session orchestration<br/>[session.go]"]
  node_feedclient["AMQP feed client<br/>[client.go]"]
  node_consumerloop["Delivery consumer<br/>[channelConsumer.go]"]
  node_xml["Feed XML decoder<br/>[decode.go]"]
  node_messagefactory["Feed message builder<br/>[feedMessage.go]"]
  node_message["Typed messages<br/>[message.go]"]
end

subgraph group_catalog["Catalog API"]
  node_api["REST API client<br/>[client.go]"]
  node_cache[("Catalog caches<br/>[manager.go]")]
  node_sportmanager["Sports catalog<br/>[manager.go]"]
  node_marketmanager["Market catalog<br/>[manager.go]"]
end

subgraph group_operations["Feed operations"]
  node_producers["Producer state<br/>[manager.go]"]
  node_recovery["Feed recovery<br/>[manager.go]"]
  node_replay["Replay controls<br/>[manager.go]"]
end

node_consumer(("SDK consumer"))
node_broker(("AMQP broker"))
node_restservice(("Oddin REST API"))

node_consumer -->|"configures"| node_client
node_client -->|"creates"| node_subscription
node_subscription -.->|"receives messages"| node_session
node_session -->|"uses"| node_feedclient
node_feedclient -->|"connects"| node_broker
node_session -->|"dispatches deliveries"| node_consumerloop
node_consumerloop -->|"decodes"| node_xml
node_consumerloop -->|"builds messages"| node_messagefactory
node_messagefactory -->|"produces"| node_message
node_client -->|"sets up"| node_api
node_api -->|"requests data"| node_restservice
node_sportmanager -->|"fetches catalog"| node_api
node_sportmanager -->|"uses"| node_cache
node_marketmanager -->|"reads and clears"| node_cache
node_marketmanager -.->|"loads descriptions"| node_api
node_client -.->|"sets up"| node_producers
node_client -.->|"sets up"| node_recovery
node_client -.->|"exposes"| node_replay
node_replay -->|"controls replay"| node_api
node_replay -->|"resolves matches"| node_sportmanager

click node_client "https://github.com/oddin-gg/gosdk/blob/main/client.go"
click node_config "https://github.com/oddin-gg/gosdk/blob/main/config.go"
click node_subscription "https://github.com/oddin-gg/gosdk/blob/main/subscription.go"
click node_session "https://github.com/oddin-gg/gosdk/blob/main/session.go"
click node_feedclient "https://github.com/oddin-gg/gosdk/blob/main/internal/feed/client.go"
click node_consumerloop "https://github.com/oddin-gg/gosdk/blob/main/internal/feed/channelConsumer.go"
click node_xml "https://github.com/oddin-gg/gosdk/blob/main/internal/feed/xml/decode.go"
click node_messagefactory "https://github.com/oddin-gg/gosdk/blob/main/internal/factory/feedMessage.go"
click node_message "https://github.com/oddin-gg/gosdk/blob/main/types/message.go"
click node_api "https://github.com/oddin-gg/gosdk/blob/main/internal/api/client.go"
click node_cache "https://github.com/oddin-gg/gosdk/blob/main/internal/cache/manager.go"
click node_sportmanager "https://github.com/oddin-gg/gosdk/blob/main/internal/sport/manager.go"
click node_marketmanager "https://github.com/oddin-gg/gosdk/blob/main/internal/market/manager.go"
click node_producers "https://github.com/oddin-gg/gosdk/blob/main/internal/producer/manager.go"
click node_recovery "https://github.com/oddin-gg/gosdk/blob/main/internal/recovery/manager.go"
click node_replay "https://github.com/oddin-gg/gosdk/blob/main/internal/replay/manager.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client,node_config,node_subscription toneBlue
class node_session,node_feedclient,node_consumerloop,node_xml,node_messagefactory,node_message toneAmber
class node_api,node_cache,node_sportmanager,node_marketmanager,node_restservice toneMint
class node_producers,node_recovery,node_replay toneRose
class node_consumer,node_broker toneIndigo
```

## Components

### Client lifecycle

- [Client lifecycle](https://github.com/oddin-gg/gosdk/blob/main/client.go): `client.go`
- [Configuration](https://github.com/oddin-gg/gosdk/blob/main/config.go): `config.go`
- [Subscription](https://github.com/oddin-gg/gosdk/blob/main/subscription.go): `subscription.go`

### Streaming feed

- [Session orchestration](https://github.com/oddin-gg/gosdk/blob/main/session.go): `session.go`
- [AMQP feed client](https://github.com/oddin-gg/gosdk/blob/main/internal/feed/client.go): `internal/feed/client.go`
- [Delivery consumer](https://github.com/oddin-gg/gosdk/blob/main/internal/feed/channelConsumer.go): `internal/feed/channelConsumer.go`
- [Feed XML decoder](https://github.com/oddin-gg/gosdk/blob/main/internal/feed/xml/decode.go): `internal/feed/xml/decode.go`
- [Feed message builder](https://github.com/oddin-gg/gosdk/blob/main/internal/factory/feedMessage.go): `internal/factory/feedMessage.go`
- [Typed messages](https://github.com/oddin-gg/gosdk/blob/main/types/message.go): `types/message.go`

### Catalog API

- [REST API client](https://github.com/oddin-gg/gosdk/blob/main/internal/api/client.go): `internal/api/client.go`
- [Catalog caches](https://github.com/oddin-gg/gosdk/blob/main/internal/cache/manager.go): `internal/cache/manager.go`
- [Sports catalog](https://github.com/oddin-gg/gosdk/blob/main/internal/sport/manager.go): `internal/sport/manager.go`
- [Market catalog](https://github.com/oddin-gg/gosdk/blob/main/internal/market/manager.go): `internal/market/manager.go`

### Feed operations

- [Producer state](https://github.com/oddin-gg/gosdk/blob/main/internal/producer/manager.go): `internal/producer/manager.go`
- [Feed recovery](https://github.com/oddin-gg/gosdk/blob/main/internal/recovery/manager.go): `internal/recovery/manager.go`
- [Replay controls](https://github.com/oddin-gg/gosdk/blob/main/internal/replay/manager.go): `internal/replay/manager.go`

### Other components

- **SDK consumer**
- **AMQP broker**
- **Oddin REST API**

## Connections

- SDK consumer → Client lifecycle: configures
- Client lifecycle → Subscription: creates
- Subscription → Session orchestration: receives messages
- Session orchestration → AMQP feed client: uses (evidence: `session.go`)
- AMQP feed client → AMQP broker: connects (evidence: `internal/feed/client.go`)
- Session orchestration → Delivery consumer: dispatches deliveries (evidence: `session.go`)
- Delivery consumer → Feed XML decoder: decodes (evidence: `internal/feed/channelConsumer.go`)
- Delivery consumer → Feed message builder: builds messages (evidence: `internal/feed/channelConsumer.go`)
- Feed message builder → Typed messages: produces (evidence: `internal/factory/feedMessage.go`)
- Client lifecycle → REST API client: sets up
- REST API client → Oddin REST API: requests data (evidence: `internal/api/client.go`)
- Sports catalog → REST API client: fetches catalog (evidence: `internal/sport/manager.go`)
- Sports catalog → Catalog caches: uses (evidence: `internal/sport/manager.go`)
- Market catalog → Catalog caches: reads and clears (evidence: `internal/market/manager.go`)
- Market catalog → REST API client: loads descriptions
- Client lifecycle → Producer state: sets up
- Client lifecycle → Feed recovery: sets up
- Client lifecycle → Replay controls: exposes
- Replay controls → REST API client: controls replay (evidence: `internal/replay/manager.go`)
- Replay controls → Sports catalog: resolves matches (evidence: `internal/replay/manager.go`)
