github.com/awslabs/clencli@v0.0.0-20210514234156-7ecf17182a20/cobra/model/unsplash.go (about)

     1  /*
     2  Copyright © 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
     3  Licensed under the Apache License, Version 2.0 (the "License");
     4  you may not use this file except in compliance with the License.
     5  You may obtain a copy of the License at
     6  
     7      http://www.apache.org/licenses/LICENSE-2.0
     8  
     9  Unless required by applicable law or agreed to in writing, software
    10  distributed under the License is distributed on an "AS IS" BASIS,
    11  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  See the License for the specific language governing permissions and
    13  limitations under the License.
    14  */
    15  
    16  package model
    17  
    18  // Unsplash does ...
    19  type Unsplash struct {
    20  	RandomPhoto UnsplashRandomPhoto `yaml:"randomPhoto"`
    21  }
    22  
    23  // UnsplashRandomPhoto ...
    24  type UnsplashRandomPhoto struct {
    25  	Parameters UnsplashRandomPhotoParameters `yaml:"parameters"`
    26  	Response   UnsplashRandomPhotoResponse   `yaml:"response,omitempty"`
    27  }
    28  
    29  // UnsplashRandomPhotoParameters struct from Unsplash command
    30  type UnsplashRandomPhotoParameters struct {
    31  	Collections string `yaml:"collections"`
    32  	Featured    bool   `yaml:"featured"`
    33  	Filter      string `yaml:"filter"`
    34  	Orientation string `yaml:"orientation"`
    35  	Query       string `yaml:"query"`
    36  	Size        string `yaml:"size"`
    37  	Username    string `yaml:"username"`
    38  }
    39  
    40  // UnsplashRandomPhotoResponse is a struct from Unsplash API Randm Request
    41  type UnsplashRandomPhotoResponse struct {
    42  	ID             string      `json:"id"`
    43  	CreatedAt      string      `json:"createdAt"`
    44  	UpdatedAt      string      `json:"updatedAt"`
    45  	PromotedAt     interface{} `json:"promotedAt"`
    46  	Width          int         `json:"width"`
    47  	Height         int         `json:"height"`
    48  	Color          string      `json:"color"`
    49  	Description    string      `json:"description"`
    50  	AltDescription string      `json:"altDescription"`
    51  	Urls           struct {
    52  		Raw     string `json:"raw"`
    53  		Full    string `json:"full"`
    54  		Regular string `json:"regular"`
    55  		Small   string `json:"small"`
    56  		Thumb   string `json:"thumb"`
    57  	} `json:"urls"`
    58  	Links struct {
    59  		Self             string `json:"self"`
    60  		HTML             string `json:"html"`
    61  		Download         string `json:"download"`
    62  		DownloadLocation string `json:"downloadLocation"`
    63  	} `json:"links"`
    64  	Categories             []interface{} `json:"categories"`
    65  	Likes                  int           `json:"likes"`
    66  	LikedByUser            bool          `json:"likedByUser"`
    67  	CurrentUserCollections []interface{} `json:"currentUserCollections"`
    68  	Sponsorship            interface{}   `json:"sponsorship"`
    69  	User                   struct {
    70  		ID              string `json:"id"`
    71  		UpdatedAt       string `json:"updatedAt"`
    72  		Username        string `json:"username"`
    73  		Name            string `json:"name"`
    74  		FirstName       string `json:"firstName"`
    75  		LastName        string `json:"lastName"`
    76  		TwitterUsername string `json:"twitterUsername"`
    77  		PortfolioURL    string `json:"portfolioUrl"`
    78  		Bio             string `json:"bio"`
    79  		Location        string `json:"location"`
    80  		Links           struct {
    81  			Self      string `json:"self"`
    82  			HTML      string `json:"html"`
    83  			Photos    string `json:"photos"`
    84  			Likes     string `json:"likes"`
    85  			Portfolio string `json:"portfolio"`
    86  			Following string `json:"following"`
    87  			Followers string `json:"followers"`
    88  		} `json:"links"`
    89  		ProfileImage struct {
    90  			Small  string `json:"small"`
    91  			Medium string `json:"medium"`
    92  			Large  string `json:"large"`
    93  		} `json:"profileImage"`
    94  		InstagramUsername string `json:"instagramUsername"`
    95  		TotalCollections  int    `json:"totalCollections"`
    96  		TotalLikes        int    `json:"totalLikes"`
    97  		TotalPhotos       int    `json:"totalPhotos"`
    98  		AcceptedTos       bool   `json:"acceptedTos"`
    99  	} `json:"user"`
   100  	Exif struct {
   101  		Make         string `json:"make"`
   102  		Model        string `json:"model"`
   103  		ExposureTime string `json:"exposureTime"`
   104  		Aperture     string `json:"aperture"`
   105  		FocalLength  string `json:"focalLength"`
   106  		Iso          int    `json:"iso"`
   107  	} `json:"exif"`
   108  	Location struct {
   109  		Title    string      `json:"title"`
   110  		Name     string      `json:"name"`
   111  		City     interface{} `json:"city"`
   112  		Country  string      `json:"country"`
   113  		Position struct {
   114  			Latitude  float64 `json:"latitude"`
   115  			Longitude float64 `json:"longitude"`
   116  		} `json:"position"`
   117  	} `json:"location"`
   118  	Views     int `json:"views"`
   119  	Downloads int `json:"downloads"`
   120  }
   121  
   122  // UnsplashGetPhotoResponse TODO ...
   123  type UnsplashGetPhotoResponse struct {
   124  	ID             string `json:"id"`
   125  	CreatedAt      string `json:"created_at"`
   126  	UpdatedAt      string `json:"updated_at"`
   127  	PromotedAt     string `json:"promoted_at"`
   128  	Width          int    `json:"width"`
   129  	Height         int    `json:"height"`
   130  	Color          string `json:"color"`
   131  	BlurHash       string `json:"blur_hash"`
   132  	Description    string `json:"description"`
   133  	AltDescription string `json:"alt_description"`
   134  	Urls           struct {
   135  		Raw     string `json:"raw"`
   136  		Full    string `json:"full"`
   137  		Regular string `json:"regular"`
   138  		Small   string `json:"small"`
   139  		Thumb   string `json:"thumb"`
   140  	} `json:"urls"`
   141  	Links struct {
   142  		Self             string `json:"self"`
   143  		HTML             string `json:"html"`
   144  		Download         string `json:"download"`
   145  		DownloadLocation string `json:"download_location"`
   146  	} `json:"links"`
   147  	Categories             []interface{} `json:"categories"`
   148  	Likes                  int           `json:"likes"`
   149  	LikedByUser            bool          `json:"liked_by_user"`
   150  	CurrentUserCollections []interface{} `json:"current_user_collections"`
   151  	Sponsorship            interface{}   `json:"sponsorship"`
   152  	User                   struct {
   153  		ID              string `json:"id"`
   154  		UpdatedAt       string `json:"updated_at"`
   155  		Username        string `json:"username"`
   156  		Name            string `json:"name"`
   157  		FirstName       string `json:"first_name"`
   158  		LastName        string `json:"last_name"`
   159  		TwitterUsername string `json:"twitter_username"`
   160  		PortfolioURL    string `json:"portfolio_url"`
   161  		Bio             string `json:"bio"`
   162  		Location        string `json:"location"`
   163  		Links           struct {
   164  			Self      string `json:"self"`
   165  			HTML      string `json:"html"`
   166  			Photos    string `json:"photos"`
   167  			Likes     string `json:"likes"`
   168  			Portfolio string `json:"portfolio"`
   169  			Following string `json:"following"`
   170  			Followers string `json:"followers"`
   171  		} `json:"links"`
   172  		ProfileImage struct {
   173  			Small  string `json:"small"`
   174  			Medium string `json:"medium"`
   175  			Large  string `json:"large"`
   176  		} `json:"profile_image"`
   177  		InstagramUsername string `json:"instagram_username"`
   178  		TotalCollections  int    `json:"total_collections"`
   179  		TotalLikes        int    `json:"total_likes"`
   180  		TotalPhotos       int    `json:"total_photos"`
   181  		AcceptedTos       bool   `json:"accepted_tos"`
   182  	} `json:"user"`
   183  	Exif struct {
   184  		Make         string `json:"make"`
   185  		Model        string `json:"model"`
   186  		ExposureTime string `json:"exposure_time"`
   187  		Aperture     string `json:"aperture"`
   188  		FocalLength  string `json:"focal_length"`
   189  		Iso          int    `json:"iso"`
   190  	} `json:"exif"`
   191  	Location struct {
   192  		Title    string `json:"title"`
   193  		Name     string `json:"name"`
   194  		City     string `json:"city"`
   195  		Country  string `json:"country"`
   196  		Position struct {
   197  			Latitude  interface{} `json:"latitude"`
   198  			Longitude interface{} `json:"longitude"`
   199  		} `json:"position"`
   200  	} `json:"location"`
   201  	Meta struct {
   202  		Index bool `json:"index"`
   203  	} `json:"meta"`
   204  	Tags []struct {
   205  		Type   string `json:"type"`
   206  		Title  string `json:"title"`
   207  		Source struct {
   208  			Ancestry struct {
   209  				Type struct {
   210  					Slug       string `json:"slug"`
   211  					PrettySlug string `json:"pretty_slug"`
   212  				} `json:"type"`
   213  				Category struct {
   214  					Slug       string `json:"slug"`
   215  					PrettySlug string `json:"pretty_slug"`
   216  				} `json:"category"`
   217  				Subcategory struct {
   218  					Slug       string `json:"slug"`
   219  					PrettySlug string `json:"pretty_slug"`
   220  				} `json:"subcategory"`
   221  			} `json:"ancestry"`
   222  			Title           string `json:"title"`
   223  			Subtitle        string `json:"subtitle"`
   224  			Description     string `json:"description"`
   225  			MetaTitle       string `json:"meta_title"`
   226  			MetaDescription string `json:"meta_description"`
   227  			CoverPhoto      struct {
   228  				ID             string      `json:"id"`
   229  				CreatedAt      string      `json:"created_at"`
   230  				UpdatedAt      string      `json:"updated_at"`
   231  				PromotedAt     string      `json:"promoted_at"`
   232  				Width          int         `json:"width"`
   233  				Height         int         `json:"height"`
   234  				Color          string      `json:"color"`
   235  				BlurHash       string      `json:"blur_hash"`
   236  				Description    interface{} `json:"description"`
   237  				AltDescription string      `json:"alt_description"`
   238  				Urls           struct {
   239  					Raw     string `json:"raw"`
   240  					Full    string `json:"full"`
   241  					Regular string `json:"regular"`
   242  					Small   string `json:"small"`
   243  					Thumb   string `json:"thumb"`
   244  				} `json:"urls"`
   245  				Links struct {
   246  					Self             string `json:"self"`
   247  					HTML             string `json:"html"`
   248  					Download         string `json:"download"`
   249  					DownloadLocation string `json:"download_location"`
   250  				} `json:"links"`
   251  				Categories             []interface{} `json:"categories"`
   252  				Likes                  int           `json:"likes"`
   253  				LikedByUser            bool          `json:"liked_by_user"`
   254  				CurrentUserCollections []interface{} `json:"current_user_collections"`
   255  				Sponsorship            interface{}   `json:"sponsorship"`
   256  				User                   struct {
   257  					ID              string `json:"id"`
   258  					UpdatedAt       string `json:"updated_at"`
   259  					Username        string `json:"username"`
   260  					Name            string `json:"name"`
   261  					FirstName       string `json:"first_name"`
   262  					LastName        string `json:"last_name"`
   263  					TwitterUsername string `json:"twitter_username"`
   264  					PortfolioURL    string `json:"portfolio_url"`
   265  					Bio             string `json:"bio"`
   266  					Location        string `json:"location"`
   267  					Links           struct {
   268  						Self      string `json:"self"`
   269  						HTML      string `json:"html"`
   270  						Photos    string `json:"photos"`
   271  						Likes     string `json:"likes"`
   272  						Portfolio string `json:"portfolio"`
   273  						Following string `json:"following"`
   274  						Followers string `json:"followers"`
   275  					} `json:"links"`
   276  					ProfileImage struct {
   277  						Small  string `json:"small"`
   278  						Medium string `json:"medium"`
   279  						Large  string `json:"large"`
   280  					} `json:"profile_image"`
   281  					InstagramUsername string `json:"instagram_username"`
   282  					TotalCollections  int    `json:"total_collections"`
   283  					TotalLikes        int    `json:"total_likes"`
   284  					TotalPhotos       int    `json:"total_photos"`
   285  					AcceptedTos       bool   `json:"accepted_tos"`
   286  				} `json:"user"`
   287  			} `json:"cover_photo"`
   288  		} `json:"source,omitempty"`
   289  	} `json:"tags"`
   290  	RelatedCollections struct {
   291  		Total   int    `json:"total"`
   292  		Type    string `json:"type"`
   293  		Results []struct {
   294  			ID              string      `json:"id"`
   295  			Title           string      `json:"title"`
   296  			Description     interface{} `json:"description"`
   297  			PublishedAt     string      `json:"published_at"`
   298  			LastCollectedAt string      `json:"last_collected_at"`
   299  			UpdatedAt       string      `json:"updated_at"`
   300  			Curated         bool        `json:"curated"`
   301  			Featured        bool        `json:"featured"`
   302  			TotalPhotos     int         `json:"total_photos"`
   303  			Private         bool        `json:"private"`
   304  			ShareKey        string      `json:"share_key"`
   305  			Tags            []struct {
   306  				Type   string `json:"type"`
   307  				Title  string `json:"title"`
   308  				Source struct {
   309  					Ancestry struct {
   310  						Type struct {
   311  							Slug       string `json:"slug"`
   312  							PrettySlug string `json:"pretty_slug"`
   313  						} `json:"type"`
   314  						Category struct {
   315  							Slug       string `json:"slug"`
   316  							PrettySlug string `json:"pretty_slug"`
   317  						} `json:"category"`
   318  						Subcategory struct {
   319  							Slug       string `json:"slug"`
   320  							PrettySlug string `json:"pretty_slug"`
   321  						} `json:"subcategory"`
   322  					} `json:"ancestry"`
   323  					Title           string `json:"title"`
   324  					Subtitle        string `json:"subtitle"`
   325  					Description     string `json:"description"`
   326  					MetaTitle       string `json:"meta_title"`
   327  					MetaDescription string `json:"meta_description"`
   328  					CoverPhoto      struct {
   329  						ID             string      `json:"id"`
   330  						CreatedAt      string      `json:"created_at"`
   331  						UpdatedAt      string      `json:"updated_at"`
   332  						PromotedAt     string      `json:"promoted_at"`
   333  						Width          int         `json:"width"`
   334  						Height         int         `json:"height"`
   335  						Color          string      `json:"color"`
   336  						BlurHash       string      `json:"blur_hash"`
   337  						Description    interface{} `json:"description"`
   338  						AltDescription string      `json:"alt_description"`
   339  						Urls           struct {
   340  							Raw     string `json:"raw"`
   341  							Full    string `json:"full"`
   342  							Regular string `json:"regular"`
   343  							Small   string `json:"small"`
   344  							Thumb   string `json:"thumb"`
   345  						} `json:"urls"`
   346  						Links struct {
   347  							Self             string `json:"self"`
   348  							HTML             string `json:"html"`
   349  							Download         string `json:"download"`
   350  							DownloadLocation string `json:"download_location"`
   351  						} `json:"links"`
   352  						Categories             []interface{} `json:"categories"`
   353  						Likes                  int           `json:"likes"`
   354  						LikedByUser            bool          `json:"liked_by_user"`
   355  						CurrentUserCollections []interface{} `json:"current_user_collections"`
   356  						Sponsorship            interface{}   `json:"sponsorship"`
   357  						User                   struct {
   358  							ID              string      `json:"id"`
   359  							UpdatedAt       string      `json:"updated_at"`
   360  							Username        string      `json:"username"`
   361  							Name            string      `json:"name"`
   362  							FirstName       string      `json:"first_name"`
   363  							LastName        string      `json:"last_name"`
   364  							TwitterUsername interface{} `json:"twitter_username"`
   365  							PortfolioURL    interface{} `json:"portfolio_url"`
   366  							Bio             string      `json:"bio"`
   367  							Location        interface{} `json:"location"`
   368  							Links           struct {
   369  								Self      string `json:"self"`
   370  								HTML      string `json:"html"`
   371  								Photos    string `json:"photos"`
   372  								Likes     string `json:"likes"`
   373  								Portfolio string `json:"portfolio"`
   374  								Following string `json:"following"`
   375  								Followers string `json:"followers"`
   376  							} `json:"links"`
   377  							ProfileImage struct {
   378  								Small  string `json:"small"`
   379  								Medium string `json:"medium"`
   380  								Large  string `json:"large"`
   381  							} `json:"profile_image"`
   382  							InstagramUsername string `json:"instagram_username"`
   383  							TotalCollections  int    `json:"total_collections"`
   384  							TotalLikes        int    `json:"total_likes"`
   385  							TotalPhotos       int    `json:"total_photos"`
   386  							AcceptedTos       bool   `json:"accepted_tos"`
   387  						} `json:"user"`
   388  					} `json:"cover_photo"`
   389  				} `json:"source,omitempty"`
   390  			} `json:"tags"`
   391  			Links struct {
   392  				Self    string `json:"self"`
   393  				HTML    string `json:"html"`
   394  				Photos  string `json:"photos"`
   395  				Related string `json:"related"`
   396  			} `json:"links"`
   397  			User struct {
   398  				ID              string      `json:"id"`
   399  				UpdatedAt       string      `json:"updated_at"`
   400  				Username        string      `json:"username"`
   401  				Name            string      `json:"name"`
   402  				FirstName       string      `json:"first_name"`
   403  				LastName        string      `json:"last_name"`
   404  				TwitterUsername interface{} `json:"twitter_username"`
   405  				PortfolioURL    interface{} `json:"portfolio_url"`
   406  				Bio             interface{} `json:"bio"`
   407  				Location        interface{} `json:"location"`
   408  				Links           struct {
   409  					Self      string `json:"self"`
   410  					HTML      string `json:"html"`
   411  					Photos    string `json:"photos"`
   412  					Likes     string `json:"likes"`
   413  					Portfolio string `json:"portfolio"`
   414  					Following string `json:"following"`
   415  					Followers string `json:"followers"`
   416  				} `json:"links"`
   417  				ProfileImage struct {
   418  					Small  string `json:"small"`
   419  					Medium string `json:"medium"`
   420  					Large  string `json:"large"`
   421  				} `json:"profile_image"`
   422  				InstagramUsername interface{} `json:"instagram_username"`
   423  				TotalCollections  int         `json:"total_collections"`
   424  				TotalLikes        int         `json:"total_likes"`
   425  				TotalPhotos       int         `json:"total_photos"`
   426  				AcceptedTos       bool        `json:"accepted_tos"`
   427  			} `json:"user"`
   428  			CoverPhoto struct {
   429  				ID             string      `json:"id"`
   430  				CreatedAt      string      `json:"created_at"`
   431  				UpdatedAt      string      `json:"updated_at"`
   432  				PromotedAt     interface{} `json:"promoted_at"`
   433  				Width          int         `json:"width"`
   434  				Height         int         `json:"height"`
   435  				Color          string      `json:"color"`
   436  				BlurHash       string      `json:"blur_hash"`
   437  				Description    string      `json:"description"`
   438  				AltDescription string      `json:"alt_description"`
   439  				Urls           struct {
   440  					Raw     string `json:"raw"`
   441  					Full    string `json:"full"`
   442  					Regular string `json:"regular"`
   443  					Small   string `json:"small"`
   444  					Thumb   string `json:"thumb"`
   445  				} `json:"urls"`
   446  				Links struct {
   447  					Self             string `json:"self"`
   448  					HTML             string `json:"html"`
   449  					Download         string `json:"download"`
   450  					DownloadLocation string `json:"download_location"`
   451  				} `json:"links"`
   452  				Categories             []interface{} `json:"categories"`
   453  				Likes                  int           `json:"likes"`
   454  				LikedByUser            bool          `json:"liked_by_user"`
   455  				CurrentUserCollections []interface{} `json:"current_user_collections"`
   456  				Sponsorship            interface{}   `json:"sponsorship"`
   457  				User                   struct {
   458  					ID              string      `json:"id"`
   459  					UpdatedAt       string      `json:"updated_at"`
   460  					Username        string      `json:"username"`
   461  					Name            string      `json:"name"`
   462  					FirstName       string      `json:"first_name"`
   463  					LastName        string      `json:"last_name"`
   464  					TwitterUsername interface{} `json:"twitter_username"`
   465  					PortfolioURL    string      `json:"portfolio_url"`
   466  					Bio             string      `json:"bio"`
   467  					Location        string      `json:"location"`
   468  					Links           struct {
   469  						Self      string `json:"self"`
   470  						HTML      string `json:"html"`
   471  						Photos    string `json:"photos"`
   472  						Likes     string `json:"likes"`
   473  						Portfolio string `json:"portfolio"`
   474  						Following string `json:"following"`
   475  						Followers string `json:"followers"`
   476  					} `json:"links"`
   477  					ProfileImage struct {
   478  						Small  string `json:"small"`
   479  						Medium string `json:"medium"`
   480  						Large  string `json:"large"`
   481  					} `json:"profile_image"`
   482  					InstagramUsername interface{} `json:"instagram_username"`
   483  					TotalCollections  int         `json:"total_collections"`
   484  					TotalLikes        int         `json:"total_likes"`
   485  					TotalPhotos       int         `json:"total_photos"`
   486  					AcceptedTos       bool        `json:"accepted_tos"`
   487  				} `json:"user"`
   488  			} `json:"cover_photo"`
   489  			PreviewPhotos []struct {
   490  				ID        string `json:"id"`
   491  				CreatedAt string `json:"created_at"`
   492  				UpdatedAt string `json:"updated_at"`
   493  				BlurHash  string `json:"blur_hash"`
   494  				Urls      struct {
   495  					Raw     string `json:"raw"`
   496  					Full    string `json:"full"`
   497  					Regular string `json:"regular"`
   498  					Small   string `json:"small"`
   499  					Thumb   string `json:"thumb"`
   500  				} `json:"urls"`
   501  			} `json:"preview_photos"`
   502  		} `json:"results"`
   503  	} `json:"related_collections"`
   504  	Views     int `json:"views"`
   505  	Downloads int `json:"downloads"`
   506  }