-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
General
: Release 1.2.0 - Merge pull request #154
- Loading branch information
Showing
39 changed files
with
1,443 additions
and
426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
ArtemisKit/Sources/CourseView/Services/ExerciseService/ExerciseChannelService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// ExerciseChannelService.swift | ||
// | ||
// | ||
// Created by Anian Schleyer on 18.08.24. | ||
// | ||
|
||
import Foundation | ||
import Common | ||
import SharedModels | ||
|
||
protocol ExerciseChannelService { | ||
func getAssociatedChannel(for exerciseId: Int, in courseId: Int) async -> DataState<Channel> | ||
} | ||
|
||
enum ExerciseChannelServiceFactory { | ||
static let shared: ExerciseChannelService = ExerciseChannelServiceImpl() | ||
} |
41 changes: 41 additions & 0 deletions
41
ArtemisKit/Sources/CourseView/Services/ExerciseService/ExerciseChannelServiceImpl.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// ExerciseChannelServiceImpl.swift | ||
// | ||
// | ||
// Created by Anian Schleyer on 18.08.24. | ||
// | ||
|
||
import APIClient | ||
import Common | ||
import SharedModels | ||
|
||
struct ExerciseChannelServiceImpl: ExerciseChannelService { | ||
|
||
let client = APIClient() | ||
|
||
struct GetExerciseChannelRequest: APIRequest { | ||
typealias Response = Channel | ||
|
||
let courseId: Int | ||
let exerciseId: Int | ||
|
||
var method: HTTPMethod { | ||
.get | ||
} | ||
|
||
var resourceName: String { | ||
"api/courses/\(courseId)/exercises/\(exerciseId)/channel" | ||
} | ||
} | ||
|
||
func getAssociatedChannel(for exerciseId: Int, in courseId: Int) async -> DataState<Channel> { | ||
let result = await client.sendRequest(GetExerciseChannelRequest(courseId: courseId, exerciseId: exerciseId)) | ||
|
||
switch result { | ||
case let .success((response, _)): | ||
return .done(response: response) | ||
case let .failure(error): | ||
return .failure(error: UserFacingError(error: error)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.