Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

How can I edit the title and description of a video? #427

Open
diegoot-dev opened this issue Nov 9, 2020 · 1 comment
Open

How can I edit the title and description of a video? #427

diegoot-dev opened this issue Nov 9, 2020 · 1 comment

Comments

@diegoot-dev
Copy link

diegoot-dev commented Nov 9, 2020

I try various ways and I have the following error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (VIMVideo)'

I have the following code:

`authenticationController.clientCredentialsGrant { result in
switch result {

            case .success(let account):
                print("Successfully authenticated with account: \(account)")
                            
                let videoRequest = Request<VIMVideo>(path: "/videos/"+self.videoId!)

                vimeoClient.request(videoRequest) { result in
                    switch result {
                    case .success(let response):
                        let video: VIMVideo = response.model
                        print("retrieved video: \(video)")
                                          
                        video.name = "new title"
                        video.videoDescription = "new description"
                        let videoRequest1 = Request<VIMVideo>(method: HTTPMethod.patch, path: "/videos/"+self.videoId!, parameters: [video], modelKeyPath: nil, useCache: false, cacheResponse: false, retryPolicy: nil)
                        vimeoClient.request(videoRequest1){result in
                            switch result {
                                case .success(let response):
                                    let video: VIMVideo = response.model
                                    print("retrieved video: \(video)")
                                case .failure(let error):
                                    print("error updating video: \(error)")
                                }
                        }
                        
                        
                    case .failure(let error ):
                        print("error retrieving video: \(error)")
                    }
                }
                
                
                
                
            case .failure(let error):
                print("error authenticating: \(error)")
                
                
            }
        }`

Thanks for your support

@nelsonnil
Copy link

I have same issue, has got the solution

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants