From def79f13834b404676b4f79d46c199c3355fa3bf Mon Sep 17 00:00:00 2001
From: Martin Schmollinger <martin.schmollinger@reutlingen-university.de>
Date: Mon, 8 Apr 2024 10:46:57 +0200
Subject: [PATCH] Updated Joke API

---
 src/gojoke/main.go  | 4 ++--
 src/gojoke/types.go | 9 ++-------
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/gojoke/main.go b/src/gojoke/main.go
index a7cc87e..b88a297 100644
--- a/src/gojoke/main.go
+++ b/src/gojoke/main.go
@@ -8,7 +8,7 @@ import (
 )
 
 const (
-	url = "http://api.icndb.com/jokes/random"
+	url = "https://api.chucknorris.io/jokes/random"
 )
 
 func main() {
@@ -23,5 +23,5 @@ func main() {
 	if err != nil {
 		log.Fatalf("Bad response\n:#%v", err)
 	}
-	log.Printf("Joke of the Day:\n%s", jokeResponse.Value.Joke)
+	log.Printf("Joke of the Day:\n%s", jokeResponse.Value)
 }
diff --git a/src/gojoke/types.go b/src/gojoke/types.go
index 01a79d4..294aaf8 100644
--- a/src/gojoke/types.go
+++ b/src/gojoke/types.go
@@ -1,12 +1,7 @@
 package main
 
 type JokeResponse struct {
-	Type  string `json:"type"`
-	Value Value  `json:"value"`
-}
-
-type Value struct {
-	Id         int      `json:"id"`
-	Joke       string   `json:"joke"`
+	Id         string   `json:"id"`
+	Value      string   `json:"value"`
 	Categories []string `json:"categories"`
 }
-- 
GitLab