Skip to content

Junaid82774464/challenge2016

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real Image Challenge 2016 - Distributors Permissions

The API enables you to determine global distribution rights for movies by checking territorial restrictions for distributors.

API Reference

Distributor Permissions

  POST /distributors/permissions

DistributorRequest

Parameter Type Description & Example
distributor string Required Distributor1
include []Location Required [{"country": "INDIA"}]
exclude []Location Optional [{"country": "CHINA"}]
location []Location Required [{"city": "CHENNAI","province": "TAMIL NADU","country": "INDIA"]}

Location

Parameter Type Description & Example
City string Optional "CHENNAI"
Province string Optional "TAMIL NADU"
Country string Optional "INDIA"

Takes the distributor, validates the request and returns whether they have permission to distribute in the selected locations.

Run Locally

Clone the project

  git clone https://github.com/Junaid82774464/challenge2016.git

Install dependencies

  go mod init golang

Start the server

  go run main.go

Examples

Sample request

[
    {
        "distributor": "DISTRIBUTOR1",
        "include": [
            {
                "country": "INDIA"
            },
            {
                "country": "UNITED STATES"
            }
        ],
        "exclude": [
            {
                "province": "KARNATAKA",
                "country": "INDIA"
            },
            {
                "city": "CHENNAI",
                "province": "TAMIL NADU",
                "country": "INDIA"
            }
        ],
        "locations": [
            {
                "city": "CHICAGO",
                "province": "ILLINOIS",
                "country": "UNITED STATES"
            },
            {
                "city": "CHENNAI",
                "province": "TAMIL NADU",
                "country": "INDIA"
            }
        ]
    }
]
Sample 200 Response

[
    {
        "distributor": "DISTRIBUTOR1",
        "permissions": "DISTRIBUTOR1 can distribute in CHICAGO-ILLINOIS-UNITED STATES"
    },
    {
        "distributor": "DISTRIBUTOR1",
        "permissions": "DISTRIBUTOR1 cannot distribute in CHENNAI-TAMIL NADU-INDIA"
    }
]
Sample 400 Response

[
    {
        "Code": "400",
        "Message": "One of the included regions is not found in the database for DISTRIBUTOR1"
    }
]

Author

About

The Real Image challenge for 2016.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Go 100.0%