only save useful att for bpph
[ppastats.git] / src / lp.h
1 /*
2  * Copyright (C) 2011-2012 jeanfi@gmail.com
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301 USA
18  */
19
20 #ifndef _PPASTATS_LP_H_
21 #define _PPASTATS_LP_H_
22
23 #define URL_BASE_LP "https://api.launchpad.net/1.0"
24
25 #define _XOPEN_SOURCE
26 #include <time.h>
27
28 struct daily_download_total {
29         int count;
30
31         struct tm date;
32 };
33
34 /* (b)inary (p)ackage (p)ublishing (h)istory */
35 struct bpph {
36         char *binary_package_name;
37         char *binary_package_version;
38         char *distro_arch_series_link;
39         char *self_link;
40         char *status;
41         int architecture_specific;
42
43         struct tm date_created;
44 };
45
46 struct distro_arch_series {
47         char *display_name;
48         char *title;
49         char *architecture_tag;
50         int is_nominated_arch_indep;
51         char *distroseries_link;
52 };
53
54 struct distro_series {
55         char *displayname;
56         char *name;
57         char *version;
58         char *title;
59 };
60
61 struct distro_series *distro_series_new(const char *name,
62                                         const char *version,
63                                         const char *title,
64                                         const char *displayname);
65
66 void distro_series_free(struct distro_series *distro_series);
67
68 void daily_download_total_list_free(struct daily_download_total **);
69
70 struct distro_arch_series *
71 distro_arch_series_new(const char *display_name,
72                        const char *title,
73                        const char *architecture_tag,
74                        int is_nominated_arch_indep,
75                        const char *distroseries_link);
76
77 void distro_arch_series_free(struct distro_arch_series *);
78
79 void bpph_free(struct bpph *b);
80
81 struct bpph *bpph_new(const char *binary_package_name,
82                       const char *binary_package_version,
83                       const char *distro_arch_series_link,
84                       const char *self_link,
85                       int architecture_specific);
86
87 void bpph_list_free(struct bpph **list);
88
89 char *get_archive_url(const char *owner, const char  *ppa);
90
91 #endif