The Movie Database Support

Session IDs are created successfully and search capabilities are working. Portions of code below:

From TMDBClient:


class func markWatchlist(mediaID: Int, watchlist: Bool, completion: @escaping (Bool, Error?) -> Void) {
    let body = MarkWatchlist(mediaType: "movie", mediaID: mediaID, watchlist: watchlist)
    taskForPOSTRequest(url: Endpoints.markWatchlist.url, body: body, response: TMDBResponse.self) { (response, error) in
        if let response = response {
            completion(response.statusCode == 1 || response.statusCode == 12 || response.statusCode == 13, nil)
        } else {
            completion(false, error)
        }
    }
}

From Endpoint in TMDBClient:


case .markWatchlist:
     return Endpoints.base + "/account/\(Auth.accountId)/watchlist" + Endpoints.apiKeyParam

Into Response Struct:


struct TMDBResponse: Codable {
    let statusCode: Int
    let statusMessage: String

    enum CodingKeys: String, CodingKey {
        case statusCode = "status_code"
        case statusMessage = "status_message"
    }
}

Any help is greatly appreciated!

  • Quincy

1 reply (on page 1 of 1)

Jump to last post

let body = MarkWatchlist(mediaType: "movie", mediaID: mediaID, watchlist: watchlist)

Does this automatically encode the body as a JSON object? The body is expected to be JSON.

There's some cURL examples I used in another post here.

Global

s focus the search bar
p open profile menu
esc close an open window
? open keyboard shortcut window

On media pages

b go back (or to parent when applicable)
e go to edit page

On TV season pages

(right arrow) go to next season
(left arrow) go to previous season

On TV episode pages

(right arrow) go to next episode
(left arrow) go to previous episode

On all image pages

a open add image window

On all edit pages

t open translation selector
ctrl+ s submit form

On discussion pages

n create new discussion
w toggle watching status
p toggle public/private
c toggle close/open
a open activity
r reply to discussion
l go to last reply
ctrl+ enter submit your message
(right arrow) next page
(left arrow) previous page